Question

Is there a way to begin a storyboard wen an ICommand is executed WITH XAML?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top