) XAML and support for defining entire UIs in XAML markup is a big draw of using WPF as an application programming foundation.
So, wouldn’t it be nice if there was a way of responding to user-driven property changes that affect the UI, without even needing to write any code at all?
Instead, the “body” is one or more Here’s an example of some triggers that are deployed as part of a re-template of an existing control.
There are two triggers: one to give a disabled button a grayed-out look, another to reflect the toggle state in the “LED” part of the button.
The Is Enabled trigger stays applied; the toggle trigger is only active when the button is selected, and otherwise reverts to the template default.
Let’s say you try this: You will not receive an error for trying to set the user control’s data context.
You will, however, discover that all data binding has stopped working. Rather than explain why this is happening, let me simply share the solution.
Windows Presentation Foundation features quite a variety of different mechanisms that provide notifications of when a property changes its value.