Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Framework.Triggers and Style.Triggers?

There are two properties of same type but exists in different classes.

  • FrameworkElement.Triggers Property
  • Style.Triggers Property

This confuses me a lot, and so I've few questions whose answer I'm looking for:

  • Why two properties of same type exist?
  • When should I use what?
  • What one can do that other cannot?
like image 625
Nawaz Avatar asked Apr 18 '11 09:04

Nawaz


1 Answers

As the documentation page that you've linked to in the question says:

FrameworkElement.Triggers can only contain EventTriggers and is not usually used. You cannot define (Property based) Triggers or (data-bound value based) DataTriggers with this method.

For most practical purposes, you should be using Style.Triggers or DataTemplate.Triggers or ControlTemplate.Triggers. (Sorry for adding to the confusion).

like image 79
Gishu Avatar answered Sep 21 '22 22:09

Gishu