Using behaviors

Triggers have inherent limitations; new trigger types cannot be created, nor new trigger actions. These decisions made by the WPF designers are somewhat arbitrary, as there may be useful triggers and actions that could have been created by developers. It may be somewhat justified, however, preventing abuse of this feature that may degrade performance (for heavy duty triggers or actions). Still, abuse is possible almost everywhere that software exists.

Whether this decision is justified or not is a matter of opinion; it is a fact nonetheless.

A possible solution to the extensibility problem is to write a similar open-ended mechanism and expose it through attached properties. This is exactly what was done by the Expression Blend team ...

Get Windows Presentation Foundation 4.5 Cookbook 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.