public class HolderNameValidation : Behavior
    {
        protected override void OnAttachedTo(Entry bindable)
        {
            bindable.TextChanged += OnInput;
            base.OnAttachedTo(bindable);
        }

        protected override void OnDetachingFrom(Entry bindable)
        {
            bindable.TextChanged -= OnInput;
            base.OnDetachingFrom(bindable);
        }

        void OnInput(object sender, TextChangedEventArgs e)
        {
            var bindable = sender as Entry;

            var firstName = parseFirstName(e.NewTextValue);
            var lastName =  parseLastName (e.NewTextValue);

            if (firstName.Item == "" || lastName.Item == "")
                 bindable.BackgroundColor = Theme.InvalidEntryColor;
            else bindable.BackgroundColor = Theme.ValidatedEntryColor;
        }
    }

xmlns:converters=”clr-namespace:Account.UI.Converters”

Behavior

Advertisements