private void MouseLeaveMenu(object sender, MouseEventArgs e) { DoubleAnimation animation = new DoubleAnimation(); animation.From = 1; animation.To = 0; animation.Duration = new Duration(TimeSpan.FromMilliseconds(50)); RectangleMenu.BeginAnimation(OpacityProperty, animation); }
private void BtnCloseMenu_Click(object sender, RoutedEventArgs e) { BtnOpenMenu.Visibility = Visibility.Visible; BtnCloseMenu.Visibility = Visibility.Collapsed; DoubleAnimation GridMenuClose = new DoubleAnimation(); DoubleAnimation LineMenuClose = new DoubleAnimation(); GridMenuClose.From = GridHamburger.ActualWidth; LineMenuClose.From = RectangleMenu.ActualWidth; GridMenuClose.To = 70; LineMenuClose.To = 47; LineMenuClose.Duration = TimeSpan.FromSeconds(0.1); GridMenuClose.Duration = TimeSpan.FromSeconds(0.1); RectangleMenu.BeginAnimation(Rectangle.WidthProperty, LineMenuClose); GridHamburger.BeginAnimation(Grid.WidthProperty, GridMenuClose); }