Yes, you can use Behavior to achieve this.
NumericValidationBehavior. cs
public class NumericValidationBehavior : Behavior<Entry> { protected override void OnAttachedTo (Entry entry) { entry.TextChanged += OnEntryTextChanged; base.OnAttachedTo (entry); } protected override void OnDetachingFrom (Entry entry) { entry.TextChanged -= OnEntryTextChanged; base.OnDetachingFrom (entry); } void OnEntryTextChanged (object sender, TextChangedEventArgs args) { string input = args.NewTextValue; bool isValid = false; double result; bool isValid_double = double.TryParse (input, out result); int result_int; bool isValid_int = int.TryParse(input, out result_int); DateTime result_date; bool isValid_date = DateTime.TryParse(input, out result_date); if (isValid_double || isValid_int|| isValid_date) { isValid = true; } ((Entry)sender).TextColor = isValid ? Color.Default : Color.Red; } }
A usage example
<StackLayout Padding="10,50,10,0"> <Label Text="Red when the number isn't valid" FontSize="Small" /> <Entry Placeholder="Enter a System.Double"> <Entry.Behaviors> <local:NumericValidationBehavior /> </Entry.Behaviors> </Entry> </StackLayout>
The result is:
Answers
Yes, you can use Behavior to achieve this.
NumericValidationBehavior. cs
A usage example
The result is:

thanks for your reply. It works, but I would also like to be able to write normal letters where the text does not turn red. How?
You mean a string made up entirely of letters?
311/5000
I want my text box to validate on both string, decimal, date and integer. So if I type in text it should be possible with a normal keyboard and numbers the numeric keypad should appear.
Then I would like my button to be turned off depending on whether it is the right user input
is it possible to make conditions such as something is enabled from the backend database and then validate?
@jezh
Do you have any rules for the string you mentioned?
BTW, any input we get from the Entey is initially in the form of a string.
No i dont have any rules for the string i mentioned, but i dont want the text color to be red when i type text...
@jezh
Then if the input is not the type you need (decimal, date and integer), how do you want to prompt?
If you want to change other property of this entry, you can just change the following code: