I have a screen with animation in my WPF application. I need the animation to run only onceper user session. This means that if a user sees the screen with the animation the first time, it would play, but when the user comes back to it it will be in its final state (skipped to end).
I have a boolean value in my ViewModel which holds all the users/sessions logic and it indicates weather or not the animation should run or it should be shown at its final frame.
How can i achieve this type of Binding / functionality only with XAML?
An easy solution would be to bind your bool Prop to the Duration-property of the Binding.
Now you need a converter which converts bool to TimeSpan, like so:
EDIT: With
SkipStoryboardToFill
mentioned in Sheridan's answer, you could do something like:But this only will work if you change the bool property while the BeginStoryboard is running.