WindowHelper Class
Provides attached properties and style management for the window component.
Definition
- Namespace: iNKORE.UI.WPF.Modern.Controls.Helpers
- Assembly: iNKORE.UI.WPF.Modern.dll
public static class WindowHelper {...}
Inheritance: No inheritance for static classes.
Dependency Properties
UseModernWindowStyle
Gets or sets whether the modern window style will be applied to the window. The modern window style is a custom window style that provides a modern look and feel to the window.
Only do you set this to true, all the properties below can work.
-
Property: Attached
-
Type:
bool
-
Default value:
false
SystemBackdropType
Gets or sets the system backdrop type of the window. You can choose one option from BackdropType Enum.
The availability of Acrylic backdrops are listed above. Mica and Tabbed are only available on Windows 11. If you're running the application on an older version of Windows, the system backdrops will not be applied.
The option Acrylic will automatically choose the best API based on the system version. If you're running the application on Windows 11, it will use Acrylic11. If you're running the application on Windows 10, it will use Acrylic10. However, this may cause some unintended behaviors.
-
Property: Attached
-
Type: BackdropType
-
Default value:
BackdropType.None
Acrylic10Color
Gets or sets the color of the Acrylic10 backdrop. This property is only works when SystemBackdropType is Acrylic10
or is Acrylic
and running on Windows 10. You can set this property to a Color value to customize the color of the Acrylic10 backdrop.
This property only accepts Color values, not Brush values. If you pass a Brush value, an exception will be thrown. You can use iNKORE.UI.WPF.Converters.ColorToBrushConverter to convert a Brush to a Color (need to revert).
-
Property: Attached
-
Type:
Color
-
Default value:
Color.FromArgb(0x99, 0x00, 0x00, 0x00)
ApplyBackground
This property decides whether the Background property will be applied to the window. If you set this property to False, the Background property will be ignored and the window will not render its background. Usually we will automatically set this property depending on the backdrop you're using. You can also set this property manually to control the background rendering, though it's not commonly used.
-
Property: Attached
-
Type:
bool
-
Default value:
true
(True when SystemBackdropType is None. Otherwise, it's False.)
ApplyNoise
This property decides whether the noise effect will be applied to the window. If you set this property to False, the noise effect will not be rendered. The noise effect is a subtle noise texture that makes the window look more natural and less flat. The default value is always False since we figured out that when you use the acrylic backdrop, the noise effect will be covered by system and it's not necessary to render the noise effect again.
You can set this property to True to enable an additional noise effect manually.
-
Property: Attached
-
Type:
bool
-
Default value:
false
CornerStyle
You can set the corner style of the window with this property. You can choose one option from WindowCornerStyle Enum.
The corner style is only available on Windows 11. If you're running the application on an older version of Windows, the corner style will not be applied.
-
Property: Attached
-
Type: WindowCornerStyle
-
Default value:
WindowCornerStyle.None
FixMaximizedWindow
Determines whether an extra maximize fixer should be applied to the window. This fixer will prevent the window from being maximized to the wrong size. This is a workaround for a bug in the default window style that causes the window to be maximized to the wrong size.
However sometimes this fixer may cause some exceptions. No worries, these exceptions are harmless and will not affect the normal use of the window.
For more information, see Window / Maximize fixer.
-
Property: Attached
-
Type:
bool
-
Default value:
true
ShouldDisplayManualBorder
Determines whether the manual border should be displayed. The manual border is a border that is drawn manually by the window. It follows the BorderBrush and BorderThickness properties of the window, which allows you to customize the border of the window.
This property is read-only. It is determined by your system version. In Windows 11 or greater, the DWM will automatically draw the border for you. In Windows 10 or lower, the manual border will be displayed.
-
Property: Attached | Read-only
-
Type:
bool
-
Default value:
false
(True when running on Windows 10 or lower. Otherwise, it's False.)
UseAeroBackdrop
This is obsolete and no longer works. Use SystemBackdropType instead.
UseAcrylicBackdrop
This is obsolete and no longer works. Use SystemBackdropType instead.
Fields
(Dependency Properties)
The dependency properties listed above each have one DependencyProperty field.
Methods
(Dependency Properties)
The attached non-readonly dependency properties listed above each have a Get and Set method;
The attached readonly dependency properties listed above each have a Get method;
UpdateWindowChrome
This method will be invoked automatically when the WindowChrome needs to be updated. You can also call this method manually to update the WindowChrome when anything unexpected happens.
public static WindowChrome UpdateWindowChrome(this Window window);
Remarks
Component
This class is used to customize the Window component.