This video describes what a trigger is and shows how to implement it.
- [Instructor] What's a trigger? Triggers are ways that allow you to express actions and make dynamic appearance changes to visual elements in your XAML files, the appearance changes based on properties and events referenced in your XAML. An example of a trigger is changing the entry text color based on the text formatting or making a button visible based on form requirements. Triggers should only be used to modify a visual element's appearance. There are four types of triggers.
Property triggers change appearance based on the property of the control it's attached to. This trigger looks at one property and changes the appearance. This is the simplest and most reusable of triggers. Data triggers change control appearance based on data binding properties. Views that adhere to this trigger normally changes based on the properties associated to the ViewModel. Event Triggers are activated based on events fired for a control. For example, changing the appearance of an entry view on the TextChanged event fires.
And finally, multi triggers check multiple conditions in order for a trigger to be activated. Think of this as one large if/and condition for a trigger occurring.
- Creating and implementing behaviors
- Stacking behaviors
- Adding behaviors to styles
- Creating commands
- Setting up and implementing triggers
- Tying it all together in a Xamarin app