Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

CustomEntry Bindable Property

$
0
0

I trying to create a customEntry which calls Unfocus method if MVVM boolean changes to false.

    <local:CustomEntry
                ChangeFocus="{Binding MyViewModelPropertyVisible}" />

    public class CustomEntry : Entry
        {
            public CustomEntry()
                : base()
            { }

            public static BindableProperty ChangeFocusProperty = BindableProperty.Create<CustomEntry, bool>(c => c.ChangeFocus, false);

            public bool ChangeFocus
            {
                get
                {
                    return (bool)base.GetValue(ChangeFocusProperty);
                }
                set
                {
                    if (!value && this.IsFocused) this.Unfocus();
                    base.SetValue(ChangeFocusProperty, value);
                }
            }

        }

The viewmodel is working properly, the problem is that ChangeFocus Property is not been calling, am I missing something?

Tks


Viewing all articles
Browse latest Browse all 58056

Trending Articles