Understanding Triggers
Until now, you saw how styles can be applied to controls without condition. This is useful, but it is more useful for deciding when to apply a style. The easiest example is to consider a button: You apply a background color that you might want to change when the button gets focus; this behavior should be replicated for each button in the UI via styles. To conditionally apply styles, you use triggers. A trigger essentially represents a condition that enables you to apply a particular style when the condition is evaluated as True
. Triggers are defined within a Style.Triggers
collection, and each of them requires you to specify the property affected by the condition and a Boolean value (True
or False
) that determines when ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.