Reference: MSDN article

The rules to remember:

  • Setting TargetType without assigning x:Key allows the style to be applied to all elements of that type (internally the code sets x:Key to {x:Type yourtype}
  • Setting TargetType and then x:Key to another value requires explicit reference of the style
  • If the style is in the resources section and TargetType is not set x:Key is required
Advertisements