What is the behavior of a WPF 4 ControlStoryboardAction trigger?

Posted by jonathan_ou on Stack Overflow See other posts from Stack Overflow or by jonathan_ou
Published on 2010-04-23T02:52:15Z Indexed on 2010/04/23 2:53 UTC
Read the original article Hit count: 392

Filed under:
|

Hi all! I have a question that's been bugging me for a while:

I have a lengthy IO operation which I invoke asynchronously, and I want my UI to show a blinking text to tell the users that the data is loading.

I have an IsLoading boolean property in my ViewModel, and I used a ControlStoryboardAction to kickoff the blinking animation, which is set to repeat forever. For my ControlStoryboardAction trigger, I configured a data trigger to see if IsLoading is true, and start my storyboard if true.

My problem is, when my IO operation returns, and I set IsLoading back to false, the animation continues to play. I thought once the trigger condition evaluated to false, it would stop the animation?

I then added a second ControlStoryboardAction to stop the animation if IsLoading evaluted to false, but this didn't have any effect. The animation continued to play after IsLoading was false.

Can anyone explain to me how trigger works in ControlStoryboardAction? In normal data triggers in WPF, once the condition evaluated to false, the property would be set back to its original state. It seems triggers in WPF actions don't work the same way?

Thanks in advance for your help!

© Stack Overflow or respective owner

Related posts about wpf-triggers

Related posts about wpf-animation