Wednesday, July 13, 2016

Triggers in WPF


There are three types of Triggers available.

  • Event Trigger
Event Trigger used perform action when RoutedEvent of FrameworkElement raise.Event Trigger generally used to perform some animation on control (like : colorAnimation, doubleAnumation using KeyFrame etc.)  Let's first understand Storyboard and Animation.

Storyboard Storyboard is used to provide animation to the properties of the UIElement. Storyboard has TargetName andTargetProperty  attached properties for apply animation to the Control (TargetName) and Control Property (TargetProperty).

  • Property Trigger 

Property Trigger Executes Collections of Setters, when UIElements property value changes. To create a trigger on any controls, you have to set trigger in style of the control.


MultiTrigger MultiTrigger is used to set action on Multiple Property change. It will execute when all condition are satisfy within MulitTrigger.Condition.

 

  • Data Trigger        

 As the name suggest, DataTrigger applies property value to perform action on Data that Binding to the UIElement. DataTrigger allows to set property value when Binding Data matches specified condition.


MultiDataTrigger MultiDataTrigger is same as DataTrigger in addition property value applied on multiple condition is matches.

 

Ref this link for more details

http://www.codeproject.com/Tips/522041/Triggers-in-WPF

No comments:

Post a Comment

Code Formater

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
 
Preview Of Formatted Code