// Switch to Advanced Mode private void AdvancedMode_Click(object sender, System.Windows.RoutedEventArgs e) { if (AdvancedMode.IsChecked) { // set visiblities and size FolderGrid.Visibility = DataGridsGridSplitter.Visibility = FolderNumberBtn.Visibility = RenameSelBtn.Visibility = AddFolderBtn.Visibility = AddSubFoldersBtn.Visibility = Visibility.Visible; DataGridsGrid.ColumnDefinitions[1].Width = new GridLength(10, GridUnitType.Pixel); // define the Main Window animation DoubleAnimation mainWindow = new DoubleAnimation(); mainWindow.From = WindowWidth; mainWindow.To = WindowWidth + 350; // define the DatagridsGrid animation AnimatableGrid datagridsGrid = new AnimatableGrid(); datagridsGrid.From = new GridLength(DatagridWidth, GridUnitType.Star); datagridsGrid.To = new GridLength(DatagridWidth + 350, GridUnitType.Star); // define the FolderGrid animation AnimatableGrid folderGrid = new AnimatableGrid(); folderGrid.From = new GridLength(0, GridUnitType.Star); folderGrid.To = new GridLength(1, GridUnitType.Star); // define the duration of animations mainWindow.Duration = datagridsGrid.Duration = folderGrid.Duration = new TimeSpan(0, 0, 0, 0, 300); // execute animations and set the fill behavior (to get the gridsplitter to work correctly) this.BeginAnimation(FrameworkElement.WidthProperty, mainWindow); datagridsGrid.FillBehavior = FillBehavior.Stop; CenterMainGrid.ColumnDefinitions[2].Width = new GridLength(DatagridWidth + 350, GridUnitType.Star); CenterMainGrid.ColumnDefinitions[2].BeginAnimation(ColumnDefinition.WidthProperty, datagridsGrid); folderGrid.FillBehavior = FillBehavior.Stop; DataGridsGrid.ColumnDefinitions[0].Width = new GridLength(1, GridUnitType.Star); DataGridsGrid.ColumnDefinitions[0].BeginAnimation(ColumnDefinition.WidthProperty, folderGrid); } else { AdvancedMode.IsChecked = true; } }