private void OpenSecondaryCVNavPaneButton_Click(object sender, RoutedEventArgs e) { if (TabItemCV.IsSelected) { if (!_secondaryCvPaneOpened) { PageCV.SecondaryNavPaneColumn.Width = new GridLength(185); RootGridSecondaryPaneCol.Width = new GridLength(185); Duration duration = new Duration(TimeSpan.FromMilliseconds(100)); DoubleAnimation doubleanimation = new DoubleAnimation(185, duration); DoubleAnimation windowAnimation = new DoubleAnimation(this.Width + 185, duration); PageCV.CVSecondaryNavPane.BeginAnimation(Rectangle.WidthProperty, doubleanimation); this.BeginAnimation(MainWindow.WidthProperty, windowAnimation); AppBarSecondaryNavPane.BeginAnimation(Rectangle.WidthProperty, doubleanimation); PageCV.SecondaryNavPaneStackPanel.BeginAnimation(StackPanel.WidthProperty, doubleanimation); OpenCvSecondaryPaneButtonIcon.Source = new BitmapImage(new Uri(@"icon/icons8-Back.png", UriKind.Relative)); PageCV.CvScrollViewer.ScrollToTop(); _secondaryCvPaneOpened = true; } else { PageCV.SecondaryNavPaneColumn.Width = new GridLength(0); RootGridSecondaryPaneCol.Width = new GridLength(0); Duration duration = new Duration(TimeSpan.FromMilliseconds(100)); DoubleAnimation doubleanimation = new DoubleAnimation(0, duration); DoubleAnimation windowAnimation = new DoubleAnimation(this.Width - 185, duration); PageCV.CVSecondaryNavPane.BeginAnimation(Rectangle.WidthProperty, doubleanimation); this.BeginAnimation(MainWindow.WidthProperty, windowAnimation); AppBarSecondaryNavPane.BeginAnimation(Rectangle.WidthProperty, doubleanimation); PageCV.SecondaryNavPaneStackPanel.BeginAnimation(StackPanel.WidthProperty, doubleanimation); OpenCvSecondaryPaneButtonIcon.Source = new BitmapImage(new Uri(@"icon/icons8-Forward.png", UriKind.Relative)); _secondaryCvPaneOpened = false; } } }
private bool CloseOpenedPanes(bool paneOpened, Rectangle SecondaryNavPaneRectangle, Image ButtonIcon, StackPanel panel) { if (paneOpened) { PageCV.SecondaryNavPaneColumn.Width = new GridLength(0); RootGridSecondaryPaneCol.Width = new GridLength(0); Duration duration = new Duration(TimeSpan.FromMilliseconds(100)); DoubleAnimation doubleanimation = new DoubleAnimation(0, duration); DoubleAnimation windowAnimation = new DoubleAnimation(this.Width - 185, duration); SecondaryNavPaneRectangle.BeginAnimation(Rectangle.WidthProperty, doubleanimation); this.BeginAnimation(MainWindow.WidthProperty, windowAnimation); AppBarSecondaryNavPane.BeginAnimation(Rectangle.WidthProperty, doubleanimation); panel.BeginAnimation(StackPanel.WidthProperty, doubleanimation); ButtonIcon.Source = new BitmapImage(new Uri(@"icon/icons8-Forward.png", UriKind.Relative)); paneOpened = false; } return(paneOpened); }