Entry Validation in Xamarin.Forms I have an Entry that I want to give a red outline when the entry is empty. I'm using SyncFusion's SFTextInputLayout for my Entry and it has a property HasError that once it's set to true, it'll automatically highlight my entire in Red.

Here is the following XAML code for SFTextInputLayout

 &lt;inputLayout:SfTextInputLayout Grid.Column="0" Hint="Phone Number" ContainerType="{StaticResource RepairOrderContainerType}" HasError="{Binding IsPhoneNumberError}" FocusedColor="{StaticResource AccentColor}" VerticalOptions="Center" HorizontalOptions="Start"&gt;
       &lt;Entry Keyboard="Telephone" Style="{StaticResource TextInputStyle}" Text="{Binding PhoneNumber}"/&gt;
 &lt;/inputLayout:SfTextInputLayout&gt;


As you can see, I have two bindings that handles the text of the entry and another one to check if it has an error or not.

While this solution works, it will get redundant pretty soon as the number of my entry fields grow. For every entry field I have, I need another boolean to cover its Error property as shown below. 

  private string _phoneNumber;
    public string PhoneNumber
    {
        get =&gt; _phoneNumber;
        set
        {
            IsPhoneNumberError = string.IsNullOrWhiteSpace(value) ? true : false;
            this.RaiseAndSetIfChanged(ref _phoneNumber, _phoneNumber);
        }
    }

    private bool _isPhoneNumberError = false;
    public bool IsPhoneNumberError
    {
        get =&gt; _isPhoneNumberError;
        set
        {
            this.RaiseAndSetIfChanged(ref _isPhoneNumberError, value);
        }
    }


I'm wondering how to simplify this code?
You could have a collection of ValueConverters which would validate your TextInputs' strings. For example one could be a PhoneNumberValidator or PhoneToBoolConverter (example names there). This way HasError would bind to HasError="{Binding PhoneNumber, Converter={StaticResource PhoneNumberValidator}}". Converters are handy and you can reuse them in multiple places around your code if they are declared in your App.xaml.cs for example.