What is the best way to start animations from a ViewModel?
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?)
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?)
-
sfernandez
Site Admin
- Posts: 3013
- Joined:
Re: What is the best way to start animations from a ViewMode
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?
Re: What is the best way to start animations from a ViewMode
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?
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?
-
sfernandez
Site Admin
- Posts: 3013
- Joined:
Re: What is the best way to start animations from a ViewMode
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.
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: Semrush [Bot] and 1 guest