O'Reilly logo

Sams Teach Yourself WPF in 24 Hours by Christopher Bennage, Rob Eisenberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22. Triggers

What You’ll Learn in This Hour:

  • The rationale for triggers

  • Trigger types

  • Applying triggers to the Media Viewer

Triggers are the gateway to a wealth of WPF functionality. Up to now, our graphics and control templates have been fairly static and unresponsive to user input or changes in data. Triggers give us the power to change all that in a simple and intuitive way.

Leveraging Triggers

Triggers are a special feature of Style, ControlTemplate, DataTemplate, and FrameworkElement. Through the careful use of triggers, you can declaratively enable your UI and graphics to respond to mouse events, changes in dependency properties, and even changes in your application’s data model. Let’s look at one of the most common uses of a Trigger

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required