更新整理
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 824 B |
@@ -1,8 +1,6 @@
|
||||
|
||||
|
||||
|
||||
using WPFluent.Interop;
|
||||
|
||||
using System.Windows.Shell;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
@@ -65,12 +63,12 @@ public class FluentWindow : System.Windows.Window
|
||||
/// </summary>
|
||||
private static void OnExtendsContentIntoTitleBarChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(d is not FluentWindow window)
|
||||
if (d is not FluentWindow window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.OldValue == e.NewValue)
|
||||
if (e.OldValue == e.NewValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -83,12 +81,12 @@ public class FluentWindow : System.Windows.Window
|
||||
/// </summary>
|
||||
private static void OnWindowBackdropTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(d is not FluentWindow window)
|
||||
if (d is not FluentWindow window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.OldValue == e.NewValue)
|
||||
if (e.OldValue == e.NewValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -101,12 +99,12 @@ public class FluentWindow : System.Windows.Window
|
||||
/// </summary>
|
||||
private static void OnWindowCornerPreferenceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(d is not FluentWindow window)
|
||||
if (d is not FluentWindow window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.OldValue == e.NewValue)
|
||||
if (e.OldValue == e.NewValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -119,35 +117,15 @@ public class FluentWindow : System.Windows.Window
|
||||
/// </summary>
|
||||
protected virtual void OnBackdropTypeChanged(WindowBackdropType oldValue, WindowBackdropType newValue)
|
||||
{
|
||||
if(Appearance.ApplicationThemeManager.GetAppTheme() == Appearance.ApplicationTheme.HighContrast)
|
||||
if (Appearance.ApplicationThemeManager.GetAppTheme() == Appearance.ApplicationTheme.Unknown)
|
||||
{
|
||||
newValue = WindowBackdropType.None;
|
||||
}
|
||||
|
||||
if(InteropHelper.Handle == IntPtr.Zero)
|
||||
if (InteropHelper.Handle == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(newValue == WindowBackdropType.None)
|
||||
{
|
||||
_ = WindowBackdrop.RemoveBackdrop(this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ExtendsContentIntoTitleBar)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Cannot apply backdrop effect if {nameof(ExtendsContentIntoTitleBar)} is false.");
|
||||
}
|
||||
|
||||
if(WindowBackdrop.IsSupported(newValue) && WindowBackdrop.RemoveBackground(this))
|
||||
{
|
||||
_ = WindowBackdrop.ApplyBackdrop(this, newValue);
|
||||
|
||||
_ = WindowBackdrop.RemoveTitlebarBackground(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -155,12 +133,12 @@ public class FluentWindow : System.Windows.Window
|
||||
/// </summary>
|
||||
protected virtual void OnCornerPreferenceChanged(WindowCornerPreference oldValue, WindowCornerPreference newValue)
|
||||
{
|
||||
if(InteropHelper.Handle == IntPtr.Zero)
|
||||
if (InteropHelper.Handle == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_ = UnsafeNativeMethods.ApplyWindowCornerPreference(InteropHelper.Handle, newValue);
|
||||
//UnsafeNativeMethods.ApplyWindowCornerPreference(InteropHelper.Handle, newValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,7 +162,7 @@ public class FluentWindow : System.Windows.Window
|
||||
|
||||
// WindowStyleProperty.OverrideMetadata(typeof(FluentWindow), new FrameworkPropertyMetadata(WindowStyle.SingleBorderWindow));
|
||||
// AllowsTransparencyProperty.OverrideMetadata(typeof(FluentWindow), new FrameworkPropertyMetadata(false));
|
||||
_ = UnsafeNativeMethods.RemoveWindowTitlebarContents(this);
|
||||
//_ = UnsafeNativeMethods.RemoveWindowTitlebarContents(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
Reference in New Issue
Block a user