public bool FullScreen() { if (WindowBack == null) { return(false); } oldParent = Parent; if (Parent is StackPanel) { ((StackPanel)Parent).Children.Remove(this); } else if (Parent is Grid) { ((Grid)Parent).Children.Remove(this); } else { return(false); } oldContent = WindowBack.Content; WindowBack.Content = this; WindowBack.ResizeMode = ResizeMode.NoResize; WindowBack.WindowStyle = WindowStyle.None; WindowBack.WindowState = WindowState.Maximized; IsFullScreen = true; WindowFront.Activate(); return(true); }
public bool NormalScreen() { if (oldParent == null || WindowBack == null) { return(false); } WindowBack.Content = null; WindowBack.Content = oldContent; if (oldParent is StackPanel) { ((StackPanel)oldParent).Children.Add(this); } else if (oldParent is Grid) { ((Grid)oldParent).Children.Add(this); } else { return(false); } WindowBack.ResizeMode = ResizeMode.CanResize; WindowBack.WindowStyle = WindowStyle.SingleBorderWindow; WindowBack.WindowState = WindowState.Normal; IsFullScreen = false; WindowFront.Activate(); return(true); }
protected override void OnContentChanged(object oldContent, object newContent) { if (IsUpdatingContent | IsDesignMode) { return; } if (WindowFront != null) { IsUpdatingContent = true; try { Content = null; } finally { IsUpdatingContent = false; } WindowFront.SetContent((UIElement)newContent); } }