17.6. Visual States

So far, you've learned the most direct (and most popular) way to craft a control template: using a mix of elements, binding expressions, and triggers. The elements create the overall visual structure of the control. The bindings pull information from the properties of the control class and apply it to the elements inside. And the triggers create the interactivity, allowing the control to change its appearance when its state changes.

The advantage of this model is that it's extremely powerful and extremely flexible. You can do just about anything you want. This isn't immediately apparent in the button example, because the control template relies on built-in properties like IsMouseOver and IsPressed. But even if these properties ...

Get Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4 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.