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

Use trigger in PCL in XF 1.3.0

$
0
0

Hi.
I've read this Jesse's article

http://blog.falafel.com/triggers-xamarin-forms-1-3/

I would like to use the class described in the article

public class EntryValidation : TriggerAction {
protected override void Invoke ( Entry sender ) {
int parsed;
bool valid = int.TryParse( sender.Text, out parsed );
if ( !valid ) {
sender.TextColor = Color.Red;
} else {
sender.TextColor = Color.Blue;
}
}
}

without using xaml.
I've seen that "Entry()" has Triggers.Add method.
How can I add "EntryValidation" class to Entry.Triggers?

        Entry password = new Entry ();
        password.WidthRequest = 300;
        password.IsPassword = true;
        password.Triggers.Add(??? // here is the question

I should add a TriggerBase class (not TriggerAction class) but I've found any example.
Thanks
Alessandro


Viewing all articles
Browse latest Browse all 58056

Trending Articles