public static void FullScreen(this Window window) { if (window != null) { FullScreenInfo fullScreenInfo = WindowHelper.GetFullScreenInfo(window); if (fullScreenInfo == null) { fullScreenInfo = new FullScreenInfo { IsFullScreen = true, Height = window.RestoreBounds.Height, Width = window.RestoreBounds.Width, Top = window.Top, Left = window.Left, ResizeMode = window.ResizeMode, WindowState = window.WindowState, WindowStyle = window.WindowStyle }; WindowHelper.SetFullScreenInfo(window, fullScreenInfo); FullScreenWindowCore(window); } else if (!fullScreenInfo.IsFullScreen) { fullScreenInfo.IsFullScreen = true; fullScreenInfo.ResizeMode = window.ResizeMode; fullScreenInfo.WindowState = window.WindowState; fullScreenInfo.WindowStyle = window.WindowStyle; fullScreenInfo.Height = window.Height; fullScreenInfo.Width = window.Width; fullScreenInfo.Top = window.Top; fullScreenInfo.Left = window.Left; FullScreenWindowCore(window); } } }
public static void FullScreenCancel(this Window window) { if (window != null) { FullScreenInfo fullScreenInfo = WindowHelper.GetFullScreenInfo(window); if (fullScreenInfo != null && fullScreenInfo.IsFullScreen) { fullScreenInfo.IsFullScreen = false; //window.WindowStyle = fullScreenInfo.WindowStyle; //window.WindowStyle = fullScreenInfo.WindowStyle; //window.ResizeMode = fullScreenInfo.ResizeMode; //window.WindowState = fullScreenInfo.WindowState; NativeMethods.SetWindowPos ( new WindowInteropHelper(window).Handle, IntPtr.Zero, (int)fullScreenInfo.Left, (int)fullScreenInfo.Top, (int)fullScreenInfo.Width, (int)fullScreenInfo.Height, SWP.SHOWWINDOW ); } } }
public static bool CheckIsFullScreen(this Window window) { if (window != null) { FullScreenInfo fullScreenInfo = WindowHelper.GetFullScreenInfo(window); if (fullScreenInfo != null && fullScreenInfo.IsFullScreen) { return(true); } } return(false); }
private static void SetFullScreenInfo(DependencyObject obj, FullScreenInfo value) { obj.SetValue(FullScreenInfoProperty, value); }