martinj
Topic Author
Posts: 19
Joined: 20 Mar 2012, 15:38

What is the best way to start animations from a ViewModel?

05 Nov 2014, 16:14

It seems that DataTriggers are supposed to be used for this, but that they are not implemented in Noesis yet?

I'd like to start a storyboard when my controls is set to visible, but I can't figure out how to do it without DataTriggers. There is supposed to be a IsVisibleChanged event if I understand the documentation correctly, but it seems that it is missing too? (could otherwise be used with EventTrigger?)
 
User avatar
sfernandez
Site Admin
Posts: 1911
Joined: 22 Dec 2011, 19:20

Re: What is the best way to start animations from a ViewMode

07 Nov 2014, 11:20

The EventTrigger can only be used with RoutedEvents, and IsVisibleChanged is not one. But you can bind the IsVisible property to a property of your ViewModel, and start any Storyboard from your ViewModel property setter code. Is that enough for you?
 
martinj
Topic Author
Posts: 19
Joined: 20 Mar 2012, 15:38

Re: What is the best way to start animations from a ViewMode

07 Nov 2014, 13:17

That sounds exactly like what I'd like to do. But I'm not sure how to start a storyboard from within the ViewModel. Should I use a trigger for that? What kind of trigger should be used when DataTriggers are not available? Perhaps I've misunderstood how to approach this.

I guess that it would be easy if I broke the MVVM pattern as the VM would then be allowed to have specific information about the view. But I'd like to avoid that. What do you advice?
 
User avatar
sfernandez
Site Admin
Posts: 1911
Joined: 22 Dec 2011, 19:20

Re: What is the best way to start animations from a ViewMode

10 Nov 2014, 13:00

I was thinking on having access from the ViewModel to the Storyboard, and call storyboard.Begin(root) from the ViewModel property setter.

Without DataTriggers is the only way I can think of to start an animation. We will add them to the 1.2 version.

Sorry for the inconvenience.

Who is online

Users browsing this forum: No registered users and 1 guest