private void MouseDoubleClicked(object sender, MouseButtonEventArgs e) { var parent = this.FindParent <UC_Main>(); /*fix for graphVisibility was set manually*/ if (parent.LeftGrid.IsVisible || parent.RightGrid.IsVisible || parent.BottomGrid.IsVisible) { IsGraphFullScreen = false; } else { IsGraphFullScreen = true; } if (!IsGraphFullScreen) { //THIS WONT WORK CUZ GRID.WIDTH ISN'T DOUBLE. //TO SEE HOW TO MAKE IT WORK READ http://stackoverflow.com/questions/17265067/changing-grid-columns-rows-width-height-by-storyboard-animation-in-windows-sto parent.StartGraphFullScreenAnimation(); // Storyboard sb = (Storyboard)parent.Resources["leftGridStoryboard"]; // sb.Begin(); //parent.LeftGrid.Visibility = parent.RightGrid.Visibility = parent.BottomGrid.Visibility = Visibility.Collapsed; IsGraphFullScreen = true; } else { parent.StartGraphExitFullScreenAnimation(); IsGraphFullScreen = false; } return; #if DEBUG SciChartOsciloscope thisos = FindThis((DependencyObject)sender); if (thisos.CanOpenGraphFullScreen) { new OsciloscopeFullScreen(this).Show(); CanOpenGraphFullScreen = false; } #endif }
public static SciChartOsciloscope FindThis(DependencyObject child) { DependencyObject parent = VisualTreeHelper.GetParent(child); //CHeck if this is the end of the tree if (parent == null) { return(null); } SciChartOsciloscope parentWindow = parent as SciChartOsciloscope; if (parentWindow != null) { return(parentWindow); } else { //use recursion until it reaches a Window return(FindThis(parent)); } }