Skip to content

Commit

Permalink
Add ToggleFullScreenCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzying2001 committed May 15, 2024
1 parent 7eeb408 commit a7c515f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CefFlashBrowser/Views/BrowserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@
Command="{Binding ElementName=browser, Path=StopCommand}"/>
<KeyBinding Key="F5"
Command="{Binding ElementName=browser, Path=ReloadCommand}"/>
<!--<KeyBinding Key="F11"
Command="{Binding }"-->
<KeyBinding Key="F11"
Command="{Binding ElementName=window, Path=ToggleFullScreenCommand}"/>
<KeyBinding Key="F12"
Command="{Binding ShowDevToolsCommand}"
CommandParameter="{Binding ElementName=browser}"/>
Expand Down
11 changes: 9 additions & 2 deletions CefFlashBrowser/Views/BrowserWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
using CefFlashBrowser.Utils;
using CefFlashBrowser.WinformCefSharp4WPF;
using CefSharp;
using SimpleMvvm.Command;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;

namespace CefFlashBrowser.Views
Expand Down Expand Up @@ -119,6 +121,9 @@ public override bool OnContextMenuCommand(IWebBrowser chromiumWebBrowser, IBrows
private bool _isMaximizedBeforeFullScreen = false;


public ICommand ToggleFullScreenCommand { get; }


public bool FullScreen
{
get { return (bool)GetValue(FullScreenProperty); }
Expand All @@ -132,6 +137,8 @@ public bool FullScreen

public BrowserWindow()
{
ToggleFullScreenCommand = new DelegateCommand(() => { FullScreen = !FullScreen; });

InitializeComponent();
WindowSizeInfo.Apply(GlobalData.Settings.BrowserWindowSizeInfo, this);

Expand All @@ -151,13 +158,13 @@ private static void OnFullScreenChange(DependencyObject d, DependencyPropertyCha
if (window._isMaximizedBeforeFullScreen)
window.WindowState = WindowState.Normal;

window.Topmost = true;
//window.Topmost = true;
window.WindowStyle = WindowStyle.None;
window.WindowState = WindowState.Maximized;
}
else
{
window.Topmost = false;
//window.Topmost = false;
window.WindowStyle = WindowStyle.SingleBorderWindow;
window.WindowState = WindowState.Normal;

Expand Down

0 comments on commit a7c515f

Please sign in to comment.