Hi Andreas,
Sorry for the delay to reply.
The issue is caused by the fact that you have inverted the methods "ButtonToStartAnimationClose_Click" and "ButtonToStartAnimationOpen_Click", so that when you click the "Start" button, it launches the wrong animation (it launches the "Close" animation instead of the "Open" one).
To fix the issue, please replace the following code:
Code: Select all
private void ButtonToStartAnimationClose_Click(object sender, RoutedEventArgs e)
{
var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToOpen"];
storyboard.Begin();
ButtonToStartAnimationOpen.Visibility = Visibility.Collapsed;
ButtonToStartAnimationClose.Visibility = Visibility.Visible;
}
private void ButtonToStartAnimationOpen_Click(object sender, RoutedEventArgs e)
{
var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToClose"];
storyboard.Begin();
ButtonToStartAnimationOpen.Visibility = Visibility.Visible;
ButtonToStartAnimationClose.Visibility = Visibility.Collapsed;
}
with this one:
Code: Select all
private void ButtonToStartAnimationOpen_Click(object sender, RoutedEventArgs e)
{
var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToOpen"];
storyboard.Begin();
ButtonToStartAnimationOpen.Visibility = Visibility.Collapsed;
ButtonToStartAnimationClose.Visibility = Visibility.Visible;
}
private void ButtonToStartAnimationClose_Click(object sender, RoutedEventArgs e)
{
var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToClose"];
storyboard.Begin();
ButtonToStartAnimationOpen.Visibility = Visibility.Visible;
ButtonToStartAnimationClose.Visibility = Visibility.Collapsed;
}
Thanks
Regards