Is there a way to begin a storyboard wen an ICommand is executed WITH XAML?
Asked
Active
Viewed 634 times
1 Answers
0
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
- 477
- 4
- 9
-
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 Jan 19 '10 at 04:34
-
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 Weitzhandler Jan 19 '10 at 20:40