The official documentation for Xamarin Forms Triggers can be found here. The documentation is great, however, triggers are written in XAML which I am not so fond of. I prefer to write the UI codes programmatically. If you are like me please continue reading.

There are four types of trigger. I will walk through each of them programatically.

1. Property Trigger.

Entry myEntry1 = new Entry
Placeholder = “Tap to focus…”,
PlaceholderColor = Color.White,
BackgroundColor = Color.FromHex(“#484848”),
TextColor = Color.White,
Margin = new Thickness(0, 0, 0, 20)
Trigger propertyTrigger = new Trigger(typeof(Entry));
propertyTrigger.Property = IsFocusedProperty;
propertyTrigger.Value = true;

Setter setter = new Setter();
setter.Property = BackgroundColorProperty;
setter.Value =…



G33K, Apps Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store