/// <summary> /// This method is called when a button is clicked on the UI. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { // Stop the animation if it still runs on a previous button. // This is required for SetValue. ButtonAnimationStoryBoard.Stop(); // Convert the sender object to a button. Button button = (Button)sender; // Set the TargetNameProperty of the animation to the name of the pressed button. ButtonAnimation.SetValue(Storyboard.TargetNameProperty, button.Name); // Start the animation on the button. ButtonAnimationStoryBoard.Begin(); // Handle the Conent of the button in the EditorBar class. eBar.HandleNextInput(button.Content.ToString()); }