Is there a way to begin a storyboard wen an ICommand is executed WITH XAML?
A:
RoutedCommands involve some code-behind, but this is definitely doable.
The simplest way is to add a CommandBinding to the parent control. Something like this:
<UserControl>
<UserControl.CommandBindings>
<CommandBinding Command="ApplicationCommands.Exit" Executed="HandleExit"/>
</UserControl.CommandBindings>
</UserControl>
Then in your code-behind event handler named 'HandleExit', invoke the storyboard either by name or from the Resources collection.
Let me know if you need some more clarification.
jgraves
2010-01-19 04:31:54
You will also have to define an equivalent RoutedCommand or use one of the built-in RoutedCommands (ApplicationCommands, MediaCommands, etc). This solution won't work for a simple ICommand, unfortunately.
jgraves
2010-01-19 04:34:13
I thought about doing it xamly, with no code involved, better said, beggining the Storyboard with Xaml when the command is hit, but I guess it's impossible.
Shimmy
2010-01-19 20:40:47