Class ClientAreaBorder
If you use WindowChrome to extend the UI elements to the non-client area, you can include this container in the template of Window so that the content inside automatically fills the client area. Using this container can let you get rid of various margin adaptations done in Setter/Trigger of the style of Window when the window state changes.
public class ClientAreaBorder : Border, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, IThemeControl
- Inheritance
-
ClientAreaBorder
- Implements
- Inherited Members
Examples
<Style
x:Key="MyWindowCustomStyle"
BasedOn="{StaticResource {x:Type Window}}"
TargetType="{x:Type controls:FluentWindow}">
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<AdornerDecorator>
<controls:ClientAreaBorder
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter x:Name="ContentPresenter" />
</controls:ClientAreaBorder>
</AdornerDecorator>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Constructors
ClientAreaBorder()
public ClientAreaBorder()
Properties
ApplicationTheme
Gets the theme that is currently set.
public ApplicationTheme ApplicationTheme { get; set; }
Property Value
PaddedBorderThickness
Gets the system value for the padded border thickness (Wpf.Ui.Interop.User32.SM.CXPADDEDBORDER) in WPF units.
public Thickness PaddedBorderThickness { get; }
Property Value
ResizeFrameBorderThickness
Gets the system Wpf.Ui.Interop.User32.SM.CXFRAME and Wpf.Ui.Interop.User32.SM.CYFRAME values in WPF units.
public static Thickness ResizeFrameBorderThickness { get; }
Property Value
WindowChromeNonClientFrameThickness
Gets the thickness of the window's non-client frame used for maximizing the window with a custom chrome.
public Thickness WindowChromeNonClientFrameThickness { get; }
Property Value
Remarks
If you use a WindowChrome to extend the client area of a window to the non-client area, you need to handle the edge margin issue when the window is maximized. Use this property to get the correct margin value when the window is maximized, so that when the window is maximized, the client area can completely cover the screen client area by no less than a single pixel at any DPI. TheWpf.Ui.Interop.User32.GetSystemMetrics(Wpf.Ui.Interop.User32.SM) method cannot obtain this value directly.
Methods
OnVisualParentChanged(DependencyObject)
Invoked when the parent of this element in the visual tree is changed. Overrides OnVisualParentChanged(DependencyObject).
protected override void OnVisualParentChanged(DependencyObject oldParent)
Parameters
oldParent
DependencyObjectThe old parent element. May be null to indicate that the element did not have a visual parent previously.