views:

615

answers:

1

How can I trigger a Command in my ViewModel at the end of an animation/storyboard using XAML only.

A: 

You can create Command property in your Model and manually execute command on Animmiation Completed event

ArsenMkrt
I suppose this can be done in XAML only using eventtriggers?
bitbonk
Yea, I think because Annimation classes don't have any command property
ArsenMkrt
I can register for the event in a trigger but I can not start the command in a trigger. At least I dont't see how.
bitbonk
do you have command property in model? if(model.command.CanExecute) model.Command.Execute(...);
ArsenMkrt
I have that in the VIEWModel yes.
bitbonk
then you can execute it manually as I mentioned in last comment
ArsenMkrt
Yes but how do I wire up the AnimationCompleted Event with my ViewModel. I would not want to do it in the code behind. That's why I said "xaml only".
bitbonk
sometimes you should write some glue code in code behind,if it is not breaking model's testing functionality of course, not every requirement is possible to implement only with binding, for example when you want to show message box to verify user choice the better place to do that is code behind
ArsenMkrt