- 105KDownloads
+ 650KDownloads
- 5KGitHub Stars
+ 9KGitHub Stars
diff --git a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs
index 037a63721..57bbb17d5 100644
--- a/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs
+++ b/src/Wpf.Ui.Gallery/ViewModels/Windows/MainWindowViewModel.cs
@@ -63,7 +63,7 @@ public partial class MainWindowViewModel(IStringLocalizer
localize
new NavigationViewItem(nameof(ThumbRate), typeof(ThumbRatePage)),
new NavigationViewItem(nameof(SplitButton), typeof(SplitButtonPage)),
new NavigationViewItem(nameof(Slider), typeof(SliderPage)),
- }
+ },
},
new NavigationViewItem
{
@@ -185,23 +185,23 @@ public partial class MainWindowViewModel(IStringLocalizer localize
private ObservableCollection _trayMenuItems =
[
new Wpf.Ui.Controls.MenuItem()
- {
- Header = "Home",
+ {
+ Header = "Home",
Tag = "tray_home",
- Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 }
+ Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 },
},
new Wpf.Ui.Controls.MenuItem()
- {
- Header = "Settings",
+ {
+ Header = "Settings",
Tag = "tray_settings",
- Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 }
+ Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 },
},
new Separator(),
new Wpf.Ui.Controls.MenuItem()
- {
- Header = "Close",
+ {
+ Header = "Close",
Tag = "tray_close",
- Icon = new SymbolIcon { Symbol = SymbolRegular.Dismiss24 }
+ Icon = new SymbolIcon { Symbol = SymbolRegular.Dismiss24 },
},
];
}
diff --git a/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs b/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
index 1f7d9267f..9a2b059bb 100644
--- a/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
+++ b/src/Wpf.Ui.Tray/Internal/InternalNotifyIconManager.cs
@@ -178,7 +178,7 @@ protected virtual void OpenMenu()
// Without setting the handler window at the front, menu may appear behind the taskbar
_ = Interop.User32.SetForegroundWindow(HookWindow.Handle);
-
+
// Set placement properties for better positioning
ContextMenu.SetCurrentValue(ContextMenu.PlacementProperty, PlacementMode.MousePoint);
ContextMenu.SetCurrentValue(ContextMenu.PlacementTargetProperty, null);
diff --git a/src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs b/src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs
index 0454bbaad..4da5191f3 100644
--- a/src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs
+++ b/src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs
@@ -146,6 +146,12 @@ public static Color TertiaryAccent
///
public static Brush TertiaryAccentBrush => new SolidColorBrush(TertiaryAccent);
+ ///
+ /// Gets a value indicating whether the user has enabled accent color on title bars and window borders in Windows settings.
+ ///
+ public static bool IsAccentColorOnTitleBarsEnabled =>
+ UnsafeNativeMethods.IsAccentColorOnTitleBarsEnabled();
+
///
/// Changes the color accents of the application based on the color entered.
///
@@ -208,7 +214,13 @@ public static void Apply(
Color tertiaryAccent
)
{
- UpdateColorResources(ApplicationThemeManager.GetAppTheme(), systemAccent, primaryAccent, secondaryAccent, tertiaryAccent);
+ UpdateColorResources(
+ ApplicationThemeManager.GetAppTheme(),
+ systemAccent,
+ primaryAccent,
+ secondaryAccent,
+ tertiaryAccent
+ );
}
///
@@ -236,13 +248,13 @@ public static Color GetColorizationColor()
///
/// Updates application resources.
///
- private static void UpdateColorResources
- (
+ private static void UpdateColorResources(
ApplicationTheme applicationTheme,
Color systemAccent,
Color primaryAccent,
Color secondaryAccent,
- Color tertiaryAccent)
+ Color tertiaryAccent
+ )
{
System.Diagnostics.Debug.WriteLine("INFO | SystemAccentColor: " + systemAccent, "Wpf.Ui.Accent");
System.Diagnostics.Debug.WriteLine(
@@ -339,14 +351,25 @@ private static void UpdateColorResources
UiApplication.Current.Resources["AccentTextFillColorSecondaryBrush"] = tertiaryAccent.ToBrush();
UiApplication.Current.Resources["AccentTextFillColorTertiaryBrush"] = primaryAccent.ToBrush();
- UiApplication.Current.Resources["AccentFillColorSelectedTextBackgroundBrush"] = systemAccent.ToBrush();
+ UiApplication.Current.Resources["AccentFillColorSelectedTextBackgroundBrush"] =
+ systemAccent.ToBrush();
var themeAccent = applicationTheme == ApplicationTheme.Dark ? secondaryAccent : primaryAccent;
UiApplication.Current.Resources["AccentFillColorDefault"] = themeAccent;
UiApplication.Current.Resources["AccentFillColorDefaultBrush"] = themeAccent.ToBrush();
- UiApplication.Current.Resources["AccentFillColorSecondary"] = Color.FromArgb(229, themeAccent.R, themeAccent.G, themeAccent.B); // 229 = 0.9 * 255
+ UiApplication.Current.Resources["AccentFillColorSecondary"] = Color.FromArgb(
+ 229,
+ themeAccent.R,
+ themeAccent.G,
+ themeAccent.B
+ ); // 229 = 0.9 * 255
UiApplication.Current.Resources["AccentFillColorSecondaryBrush"] = themeAccent.ToBrush(0.9);
- UiApplication.Current.Resources["AccentFillColorTertiary"] = Color.FromArgb(204, themeAccent.R, themeAccent.G, themeAccent.B); // 204 = 0.8 * 255
+ UiApplication.Current.Resources["AccentFillColorTertiary"] = Color.FromArgb(
+ 204,
+ themeAccent.R,
+ themeAccent.G,
+ themeAccent.B
+ ); // 204 = 0.8 * 255
UiApplication.Current.Resources["AccentFillColorTertiaryBrush"] = themeAccent.ToBrush(0.8);
}
diff --git a/src/Wpf.Ui/Appearance/UISettingsRCW.cs b/src/Wpf.Ui/Appearance/UISettingsRCW.cs
index 7ea690cd9..1a85d9a58 100644
--- a/src/Wpf.Ui/Appearance/UISettingsRCW.cs
+++ b/src/Wpf.Ui/Appearance/UISettingsRCW.cs
@@ -23,7 +23,7 @@ public enum UIColorType
AccentLight1 = 6,
AccentLight2 = 7,
AccentLight3 = 8,
- Complement = 9
+ Complement = 9,
}
public static object GetUISettingsInstance()
@@ -55,13 +55,17 @@ internal static class NativeMethods
internal static extern int WindowsCreateString(
[MarshalAs(UnmanagedType.LPWStr)] string sourceString,
int length,
- out IntPtr hstring);
+ out IntPtr hstring
+ );
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
internal static extern int WindowsDeleteString(IntPtr hstring);
[DllImport("api-ms-win-core-winrt-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
- internal static extern int RoActivateInstance(IntPtr runtimeClassId, [MarshalAs(UnmanagedType.Interface)] out object instance);
+ internal static extern int RoActivateInstance(
+ IntPtr runtimeClassId,
+ [MarshalAs(UnmanagedType.Interface)] out object instance
+ );
}
[Guid("03021BE4-5254-4781-8194-5168F7D06D7B")]
@@ -82,7 +86,7 @@ internal enum TrustLevel
{
BaseTrust,
PartialTrust,
- FullTrust
+ FullTrust,
}
internal readonly record struct UIColor(byte A, byte R, byte G, byte B);
diff --git a/src/Wpf.Ui/Controls/DropDownButton/DropDownButton.cs b/src/Wpf.Ui/Controls/DropDownButton/DropDownButton.cs
index 5f8883988..a095122f1 100644
--- a/src/Wpf.Ui/Controls/DropDownButton/DropDownButton.cs
+++ b/src/Wpf.Ui/Controls/DropDownButton/DropDownButton.cs
@@ -102,7 +102,10 @@ private void OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
_contextMenu.SetCurrentValue(MinWidthProperty, ActualWidth);
_contextMenu.SetCurrentValue(ContextMenu.PlacementTargetProperty, this);
- _contextMenu.SetCurrentValue(ContextMenu.PlacementProperty, System.Windows.Controls.Primitives.PlacementMode.Bottom);
+ _contextMenu.SetCurrentValue(
+ ContextMenu.PlacementProperty,
+ System.Windows.Controls.Primitives.PlacementMode.Bottom
+ );
_contextMenu.SetCurrentValue(ContextMenu.IsOpenProperty, true);
}
}
diff --git a/src/Wpf.Ui/Controls/EffectThicknessDecorator.cs b/src/Wpf.Ui/Controls/EffectThicknessDecorator.cs
index a43c2eaac..4ab30dde6 100644
--- a/src/Wpf.Ui/Controls/EffectThicknessDecorator.cs
+++ b/src/Wpf.Ui/Controls/EffectThicknessDecorator.cs
@@ -10,14 +10,26 @@ namespace Wpf.Ui.Controls;
public class EffectThicknessDecorator : Decorator
{
- public static readonly DependencyProperty ThicknessProperty =
- DependencyProperty.Register(nameof(Thickness), typeof(Thickness), typeof(EffectThicknessDecorator), new PropertyMetadata(new Thickness(35), OnThicknessChanged));
-
- public static readonly DependencyProperty AnimationDelayProperty =
- DependencyProperty.Register(nameof(AnimationDelay), typeof(TimeSpan), typeof(EffectThicknessDecorator), new PropertyMetadata(TimeSpan.Zero));
-
- public static readonly DependencyProperty AnimationElementProperty =
- DependencyProperty.Register(nameof(AnimationElement), typeof(UIElement), typeof(EffectThicknessDecorator), new PropertyMetadata(default(UIElement)));
+ public static readonly DependencyProperty ThicknessProperty = DependencyProperty.Register(
+ nameof(Thickness),
+ typeof(Thickness),
+ typeof(EffectThicknessDecorator),
+ new PropertyMetadata(new Thickness(35), OnThicknessChanged)
+ );
+
+ public static readonly DependencyProperty AnimationDelayProperty = DependencyProperty.Register(
+ nameof(AnimationDelay),
+ typeof(TimeSpan),
+ typeof(EffectThicknessDecorator),
+ new PropertyMetadata(TimeSpan.Zero)
+ );
+
+ public static readonly DependencyProperty AnimationElementProperty = DependencyProperty.Register(
+ nameof(AnimationElement),
+ typeof(UIElement),
+ typeof(EffectThicknessDecorator),
+ new PropertyMetadata(default(UIElement))
+ );
private PopupContainer? _popupContainer;
@@ -108,7 +120,8 @@ private void SetPopupContainer()
{
animationElement.Effect = null;
- Task.Delay(AnimationDelay).ContinueWith(_ => Dispatcher.Invoke(() => animationElement.Effect = effect));
+ Task.Delay(AnimationDelay)
+ .ContinueWith(_ => Dispatcher.Invoke(() => animationElement.Effect = effect));
}
};
@@ -178,7 +191,8 @@ public PopupContainer(Popup popup)
public event EventHandler Opened;
- public FrameworkElement? FrameworkElement => _contextMenu ?? _toolTip ?? _popup?.Child as FrameworkElement;
+ public FrameworkElement? FrameworkElement =>
+ _contextMenu ?? _toolTip ?? _popup?.Child as FrameworkElement;
public void SetMargin(Thickness margin)
{
diff --git a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs
index 48715fba8..bef67db5a 100644
--- a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs
+++ b/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs
@@ -90,7 +90,7 @@ public FluentWindow()
{
ApplicationThemeManager.Changed += (_, _) =>
{
- if (IsActive)
+ if (IsActive && ApplicationAccentColorManager.IsAccentColorOnTitleBarsEnabled)
{
UnsafeNativeMethods.ApplyBorderColor(this, ApplicationAccentColorManager.SystemAccent);
}
@@ -128,7 +128,7 @@ protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
- if (Utilities.IsOSWindows11OrNewer)
+ if (Utilities.IsOSWindows11OrNewer && ApplicationAccentColorManager.IsAccentColorOnTitleBarsEnabled)
{
UnsafeNativeMethods.ApplyBorderColor(this, ApplicationAccentColorManager.SystemAccent);
}
@@ -286,16 +286,20 @@ protected virtual void SetWindowChrome()
if (Utilities.IsCompositionEnabled)
{
WindowChrome.SetWindowChrome(
- this,
- new WindowChrome
- {
- CaptionHeight = 0,
- CornerRadius = default,
- GlassFrameThickness = WindowBackdropType == WindowBackdropType.None ? new Thickness(0.00001) : new Thickness(-1), // 0.00001 so there's no glass frame drawn around the window, but the border is still drawn.
- ResizeBorderThickness = ResizeMode == ResizeMode.NoResize ? default : new Thickness(4),
- UseAeroCaptionButtons = false,
- }
- );
+ this,
+ new WindowChrome
+ {
+ CaptionHeight = 0,
+ CornerRadius = default,
+ GlassFrameThickness =
+ WindowBackdropType == WindowBackdropType.None
+ ? new Thickness(0.00001)
+ : new Thickness(-1), // 0.00001 so there's no glass frame drawn around the window, but the border is still drawn.
+ ResizeBorderThickness =
+ ResizeMode == ResizeMode.NoResize ? default : new Thickness(4),
+ UseAeroCaptionButtons = false,
+ }
+ );
}
}
catch (COMException)
diff --git a/src/Wpf.Ui/Controls/SplitButton/SplitButton.cs b/src/Wpf.Ui/Controls/SplitButton/SplitButton.cs
index 4a0399dbf..66c63ca27 100644
--- a/src/Wpf.Ui/Controls/SplitButton/SplitButton.cs
+++ b/src/Wpf.Ui/Controls/SplitButton/SplitButton.cs
@@ -95,8 +95,10 @@ private void AttachToggleButtonClick()
{
if (SplitButtonToggleButton != null)
{
- SplitButtonToggleButton.PreviewMouseLeftButtonUp -= OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
- SplitButtonToggleButton.PreviewMouseLeftButtonUp += OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
+ SplitButtonToggleButton.PreviewMouseLeftButtonUp -=
+ OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
+ SplitButtonToggleButton.PreviewMouseLeftButtonUp +=
+ OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
}
}
@@ -172,7 +174,8 @@ protected virtual void ReleaseTemplateResources()
{
if (SplitButtonToggleButton != null)
{
- SplitButtonToggleButton.PreviewMouseLeftButtonUp -= OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
+ SplitButtonToggleButton.PreviewMouseLeftButtonUp -=
+ OnSplitButtonToggleButtonOnPreviewMouseLeftButtonUp;
}
}
diff --git a/src/Wpf.Ui/Controls/TitleBar/HwndProcEventArgs.cs b/src/Wpf.Ui/Controls/TitleBar/HwndProcEventArgs.cs
index dab7a6d14..79b7c948c 100644
--- a/src/Wpf.Ui/Controls/TitleBar/HwndProcEventArgs.cs
+++ b/src/Wpf.Ui/Controls/TitleBar/HwndProcEventArgs.cs
@@ -22,7 +22,13 @@ public class HwndProcEventArgs : EventArgs
public IntPtr LParam { get; }
- internal HwndProcEventArgs(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, bool isMouseOverDetectedHeaderContent)
+ internal HwndProcEventArgs(
+ IntPtr hwnd,
+ int msg,
+ IntPtr wParam,
+ IntPtr lParam,
+ bool isMouseOverDetectedHeaderContent
+ )
{
HWND = hwnd;
Message = msg;
diff --git a/src/Wpf.Ui/Converters/ClipConverter.cs b/src/Wpf.Ui/Converters/ClipConverter.cs
index 12bb37482..ae6d0112c 100644
--- a/src/Wpf.Ui/Converters/ClipConverter.cs
+++ b/src/Wpf.Ui/Converters/ClipConverter.cs
@@ -17,7 +17,11 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
return null;
}
- if (values[0] is not double width || values[1] is not double height || values[2] is not double percentage)
+ if (
+ values[0] is not double width
+ || values[1] is not double height
+ || values[2] is not double percentage
+ )
{
return null;
}
diff --git a/src/Wpf.Ui/Converters/DatePickerButtonPaddingConverter.cs b/src/Wpf.Ui/Converters/DatePickerButtonPaddingConverter.cs
index 3db66fdb9..68ace4546 100644
--- a/src/Wpf.Ui/Converters/DatePickerButtonPaddingConverter.cs
+++ b/src/Wpf.Ui/Converters/DatePickerButtonPaddingConverter.cs
@@ -15,10 +15,11 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
if (values is [Thickness padding, Thickness buttonMargin, double buttonWidth])
{
return new Thickness(
- padding.Left,
- padding.Top,
- padding.Right + buttonMargin.Left + buttonMargin.Right + buttonWidth,
- padding.Bottom);
+ padding.Left,
+ padding.Top,
+ padding.Right + buttonMargin.Left + buttonMargin.Right + buttonWidth,
+ padding.Bottom
+ );
}
return default(Thickness);
diff --git a/src/Wpf.Ui/Extensions/UiElementExtensions.cs b/src/Wpf.Ui/Extensions/UiElementExtensions.cs
index 95b3f0f47..452c46686 100644
--- a/src/Wpf.Ui/Extensions/UiElementExtensions.cs
+++ b/src/Wpf.Ui/Extensions/UiElementExtensions.cs
@@ -30,9 +30,12 @@ public static bool IsMouseOverElement(this UIElement element, IntPtr lParam)
var mousePosition = new Point(Get_X_LParam(lParam), Get_Y_LParam(lParam));
// If element is Panel, check if children at mousePosition is with IsHitTestVisible false.
- return new Rect(default, element.RenderSize).Contains(element.PointFromScreen(mousePosition)) &&
- element.IsHitTestVisible &&
- (element is not System.Windows.Controls.Panel panel || IsChildHitTestVisibleAtPointFromScreen(panel, mousePosition));
+ return new Rect(default, element.RenderSize).Contains(element.PointFromScreen(mousePosition))
+ && element.IsHitTestVisible
+ && (
+ element is not System.Windows.Controls.Panel panel
+ || IsChildHitTestVisibleAtPointFromScreen(panel, mousePosition)
+ );
}
catch
{
@@ -50,7 +53,10 @@ private static int Get_Y_LParam(IntPtr lParam)
return (short)(lParam.ToInt32() >> 16);
}
- private static bool IsChildHitTestVisibleAtPointFromScreen(System.Windows.Controls.Panel panel, Point mousePosition)
+ private static bool IsChildHitTestVisibleAtPointFromScreen(
+ System.Windows.Controls.Panel panel,
+ Point mousePosition
+ )
{
foreach (UIElement child in panel.Children)
{
diff --git a/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs b/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
index bf9158c3d..6de8cfd1d 100644
--- a/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
+++ b/src/Wpf.Ui/Interop/UnsafeNativeMethods.cs
@@ -50,11 +50,11 @@ public static bool ApplyWindowCornerPreference(IntPtr handle, WindowCornerPrefer
int pvAttribute = (int)UnsafeReflection.Cast(cornerPreference);
return Dwmapi.DwmSetWindowAttribute(
- handle,
- Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE,
- ref pvAttribute,
- Marshal.SizeOf(typeof(int))
- ) == 0;
+ handle,
+ Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE,
+ ref pvAttribute,
+ Marshal.SizeOf(typeof(int))
+ ) == 0;
}
///
@@ -64,8 +64,7 @@ public static bool ApplyWindowCornerPreference(IntPtr handle, WindowCornerPrefer
/// The color.
/// if invocation of native Windows function succeeds.
public static bool ApplyBorderColor(Window window, Color color) =>
- GetHandle(window, out IntPtr windowHandle)
- && ApplyBorderColor(windowHandle, color);
+ GetHandle(window, out IntPtr windowHandle) && ApplyBorderColor(windowHandle, color);
///
/// Tries to apply the color of the border.
@@ -74,8 +73,7 @@ public static bool ApplyBorderColor(Window window, Color color) =>
/// The color.
/// if invocation of native Windows function succeeds.
public static bool ApplyBorderColor(Window window, int color) =>
- GetHandle(window, out IntPtr windowHandle)
- && ApplyBorderColor(windowHandle, color);
+ GetHandle(window, out IntPtr windowHandle) && ApplyBorderColor(windowHandle, color);
///
/// Tries to apply the color of the border.
@@ -106,7 +104,35 @@ public static bool ApplyBorderColor(IntPtr handle, int color)
return false;
}
- return Dwmapi.DwmSetWindowAttribute(handle, Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, ref color, sizeof(int)) == 0;
+ return Dwmapi.DwmSetWindowAttribute(
+ handle,
+ Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR,
+ ref color,
+ sizeof(int)
+ ) == 0;
+ }
+
+ ///
+ /// Checks whether accent color on title bars and window borders is enabled in Windows settings.
+ ///
+ /// if accent color on title bars is enabled.
+ public static bool IsAccentColorOnTitleBarsEnabled()
+ {
+ try
+ {
+ using RegistryKey? key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\DWM");
+
+ if (key?.GetValue("ColorPrevalence") is int value)
+ {
+ return value == 1;
+ }
+ }
+ catch
+ {
+ // Ignore registry access errors
+ }
+
+ return false;
}
///
@@ -142,7 +168,8 @@ public static bool RemoveWindowDarkMode(IntPtr handle)
dwAttribute = Dwmapi.DWMWINDOWATTRIBUTE.DMWA_USE_IMMERSIVE_DARK_MODE_OLD;
}
- return Dwmapi.DwmSetWindowAttribute(handle, dwAttribute, ref pvAttribute, Marshal.SizeOf(typeof(int))) == 0;
+ return Dwmapi.DwmSetWindowAttribute(handle, dwAttribute, ref pvAttribute, Marshal.SizeOf(typeof(int)))
+ == 0;
}
///
@@ -178,7 +205,8 @@ public static bool ApplyWindowDarkMode(IntPtr handle)
dwAttribute = Dwmapi.DWMWINDOWATTRIBUTE.DMWA_USE_IMMERSIVE_DARK_MODE_OLD;
}
- return Dwmapi.DwmSetWindowAttribute(handle, dwAttribute, ref pvAttribute, Marshal.SizeOf(typeof(int))) == 0;
+ return Dwmapi.DwmSetWindowAttribute(handle, dwAttribute, ref pvAttribute, Marshal.SizeOf(typeof(int)))
+ == 0;
}
///
@@ -258,11 +286,11 @@ public static bool ApplyWindowBackdrop(IntPtr handle, WindowBackdropType backgro
}
return Dwmapi.DwmSetWindowAttribute(
- handle,
- Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE,
- ref backdropPvAttribute,
- Marshal.SizeOf(typeof(int))
- ) == 0;
+ handle,
+ Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE,
+ ref backdropPvAttribute,
+ Marshal.SizeOf(typeof(int))
+ ) == 0;
}
///
@@ -337,11 +365,11 @@ public static bool ApplyWindowLegacyMicaEffect(IntPtr handle)
var backdropPvAttribute = 0x1; // Enable
return Dwmapi.DwmSetWindowAttribute(
- handle,
- Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_MICA_EFFECT,
- ref backdropPvAttribute,
- Marshal.SizeOf(typeof(int))
- ) == 0;
+ handle,
+ Dwmapi.DWMWINDOWATTRIBUTE.DWMWA_MICA_EFFECT,
+ ref backdropPvAttribute,
+ Marshal.SizeOf(typeof(int))
+ ) == 0;
}
///
@@ -392,9 +420,10 @@ public static Color GetAccentColor()
try
{
var accentColorValue = Registry.GetValue(
- @"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM",
- "AccentColor",
- null);
+ @"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM",
+ "AccentColor",
+ null
+ );
if (accentColorValue is not null)
{