Live Chat Icon For mobile
Live Chat Icon

How do I trigger an animation when the data in the control is changed?

Platform: WPF| Category: Animation

Animations can be applied to the objects in WPF application when the data in the control changes using the DataTriggers. The following lines of code is used to apply animations using a DataTrigger


<TextBlock Text='WPF Application' Name='tb1' Foreground='Blue' FontSize='28' TextAlignment='Center' Height='50' VerticalAlignment='Top'>
<DataTrigger Binding='{Binding ElementName=cb1,Path=IsChecked}' Value='true'>
<DoubleAnimation Storyboard.TargetProperty='Opacity' From='0' To='1' Duration='0:0:1' AutoReverse='True' RepeatBehavior='Forever' />
                  <Storyboard FillBehavior='Stop'>
<DoubleAnimation Storyboard.TargetProperty='Opacity' To='1' Duration='0:0:1' />
<CheckBox Name='cb1' Content='Show Animation' IsChecked='True' Height='30' HorizontalAlignment='Center' />

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.