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

Data trigger in code instead of Xaml?

$
0
0

I found this post http://forums.xamarin.com/discussion/33920/triggers-without-xaml that describes how to create a simple trigger that binds to and modifies a single Entry.

 Trigger trg = new Trigger (typeof(Entry));
    trg.Property = Entry.IsFocusedProperty;
    trg.Value = true;
    Setter setter = new Setter ();
    setter.Property = Entry.BackgroundColorProperty;
setter.Value = Color.Yellow;

    trg.Setters.Add(setter);

However what is the correct syntax to create a data trigger that for example enables/disables button depending on whether the Text property of an Entry is empty or not? I.e., check for non-empty value in a text field (Entry) before allowing button to be clicked.


Viewing all articles
Browse latest Browse all 58056

Trending Articles