窗口全屏切换 从退出全屏时肯定变为Normal改成变为进入全屏前的状态(即 也可能进入Maximized状态)
This commit is contained in:
@@ -25,7 +25,11 @@ public class CaptionButtons: Avalonia.Controls.Chrome.CaptionButtons
|
|||||||
private Button? _fullScreenButton;
|
private Button? _fullScreenButton;
|
||||||
|
|
||||||
private IDisposable? _visibilityDisposable;
|
private IDisposable? _visibilityDisposable;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <20>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ǰ <20><><EFBFBD>ڵ<EFBFBD>״̬
|
||||||
|
/// </summary>
|
||||||
|
private WindowState? _oldWindowState;
|
||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
_closeButton = e.NameScope.Get<Button>(PART_CloseButton);
|
_closeButton = e.NameScope.Get<Button>(PART_CloseButton);
|
||||||
@@ -43,6 +47,21 @@ public class CaptionButtons: Avalonia.Controls.Chrome.CaptionButtons
|
|||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnToggleFullScreen()
|
||||||
|
{
|
||||||
|
if (HostWindow != null)
|
||||||
|
{
|
||||||
|
if (HostWindow.WindowState != WindowState.FullScreen)
|
||||||
|
{
|
||||||
|
_oldWindowState = HostWindow.WindowState;
|
||||||
|
HostWindow.WindowState = WindowState.FullScreen;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HostWindow.WindowState = _oldWindowState.HasValue ? _oldWindowState.Value : WindowState.Normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public override void Attach(Window hostWindow)
|
public override void Attach(Window hostWindow)
|
||||||
{
|
{
|
||||||
base.Attach(hostWindow);
|
base.Attach(hostWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user