DevZest WPF Docking
WindowControl Class |
Represents a movable and resizable window hosted in WindowPanel.
Inheritance Hierarchy
SystemObject System.Windows.ThreadingDispatcherObject
System.WindowsDependencyObject
System.Windows.MediaVisual
System.WindowsUIElement
System.WindowsFrameworkElement
System.Windows.ControlsControl
System.Windows.ControlsContentControl
DevZest.WindowsWindowControl
DevZest.Windows.Docking.PrimitivesWpfFloatingWindow
System.WindowsDependencyObject
System.Windows.MediaVisual
System.WindowsUIElement
System.WindowsFrameworkElement
System.Windows.ControlsControl
System.Windows.ControlsContentControl
DevZest.WindowsWindowControl
DevZest.Windows.Docking.PrimitivesWpfFloatingWindow
Namespace: DevZest.Windows
Assembly: DevZest.WpfDocking (in DevZest.WpfDocking.dll) Version: 2.5.0.0 (2.5.5912.0)
Syntax
The WindowControl type exposes the following members.
Constructors
Name | Description | |
---|---|---|
WindowControl | Initializes a new instance of the WindowControl class |
Properties
Name | Description | |
---|---|---|
ActualLeft | Gets the actual left position of this WindowControl. | |
ActualTop | Gets the actual top position of this WindowControl. | |
Left | Gets or sets a value that represents the distance between the left side of WindowControl and the left side of its parent WindowPanel. This is a dependency property. | |
Top | Gets or sets a value that represents the distance between the top side of WindowControl and the top side of its parent WindowPanel. This is a dependency property. |
Methods
Name | Description | |
---|---|---|
EnsureVisibleLocation | Gets the adjusted location to ensure the window is visible in its container. | |
GetHotspot | Gets the value of Hotspot attached property for a given DependencyObject. | |
SetHotspot | Sets the value of Hotspot attached property for a given dependency object. |
Fields
Name | Description | |
---|---|---|
ActualLeftProperty | Identifies the ActualLeft dependency property. | |
ActualTopProperty | Identifies the ActualTop dependency property. | |
HotspotProperty | Identifies the Hotspot attached property. | |
LeftProperty | Identifies the Left dependency property. | |
TopProperty | Identifies the Top dependency property. |
Attached Properties
Name | Description | |
---|---|---|
Hotspot | Gets or sets the the WindowHotspot value. |
Remarks
Use Left and Top to specify the location of the window. NaN value results in auto location - the location will be decided by its containing WindowPanel. The containing WindowPanel sets the window's ActualLeft and ActualTop properties.
Use Hotspot attached property to specify the WindowHotspot mouse dragging value for elements in the control template. By default, WindowControl inherits ContentControl's control template which provides no movable or resizable user interface.
Examples
This example demostrates use of WindowPanel and WindowControl
(reference to assembly PresentationFramework.Classic.dll required):
XAML
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:dz="http://schemas.devzest.com/presentation" xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" WindowState="Maximized"> <Window.Resources> <ControlTemplate x:Key="WindowControlTemplate" TargetType="{x:Type dz:WindowControl}"> <ControlTemplate.Resources> <LinearGradientBrush x:Key="ActiveCaptionBrush" StartPoint="0,0.5" EndPoint="1,0.5"> <GradientStop Offset="0" Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" /> <GradientStop Offset="1" Color="{DynamicResource {x:Static SystemColors.GradientActiveCaptionColorKey}}" /> </LinearGradientBrush> <LinearGradientBrush x:Key="InactiveCaptionBrush" StartPoint="0,0.5" EndPoint="1,0.5"> <GradientStop Offset="0" Color="{DynamicResource {x:Static SystemColors.InactiveCaptionColorKey}}" /> <GradientStop Offset="1" Color="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionColorKey}}" /> </LinearGradientBrush> </ControlTemplate.Resources> <Grid Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"> <mwt:ClassicBorderDecorator Grid.Column="0" Grid.Row="0" BorderThickness="4"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Rectangle x:Name="CaptionRectangle" Grid.ColumnSpan="2" Height="{x:Static SystemParameters.CaptionHeight}" dz:WindowControl.Hotspot="Move" /> <ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"/> </Grid> </mwt:ClassicBorderDecorator> <Grid FlowDirection="LeftToRight"> <Grid.RowDefinitions> <RowDefinition Height="4" /> <RowDefinition Height="16" /> <RowDefinition Height="1*" /> <RowDefinition Height="16" /> <RowDefinition Height="4" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="4" /> <ColumnDefinition Width="16" /> <ColumnDefinition Width="1*" /> <ColumnDefinition Width="16" /> <ColumnDefinition Width="4" /> </Grid.ColumnDefinitions> <Label Background="Transparent" Cursor="SizeNWSE" Grid.Column="0" Grid.ColumnSpan="2" dz:WindowControl.Hotspot="ResizeLeftTop"/> <Label Background="Transparent" Cursor="SizeNS" Grid.Column="2" dz:WindowControl.Hotspot="ResizeTop" /> <Label Background="Transparent" Cursor="SizeNESW" Grid.Column="3" Grid.ColumnSpan="2" dz:WindowControl.Hotspot="ResizeRightTop" /> <Label Background="Transparent" Cursor="SizeNESW" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" dz:WindowControl.Hotspot="ResizeLeftBottom"/> <Label Background="Transparent" Cursor="SizeNS" Grid.Row="4" Grid.Column="2" dz:WindowControl.Hotspot="ResizeBottom" /> <Label Background="Transparent" Cursor="SizeNWSE" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="2" dz:WindowControl.Hotspot="ResizeRightBottom" /> <Label Background="Transparent" Cursor="SizeNWSE" Grid.Row="1" dz:WindowControl.Hotspot="ResizeLeftTop" /> <Label Background="Transparent" Cursor="SizeWE" Grid.Row="2" dz:WindowControl.Hotspot="ResizeLeft" /> <Label Background="Transparent" Cursor="SizeNESW" Grid.Row="3" dz:WindowControl.Hotspot="ResizeLeftBottom" /> <Label Background="Transparent" Cursor="SizeNESW" Grid.Row="1" Grid.Column="4" dz:WindowControl.Hotspot="ResizeRightTop"/> <Label Background="Transparent" Cursor="SizeWE" Grid.Row="2" Grid.Column="4" dz:WindowControl.Hotspot="ResizeRight" /> <Label Background="Transparent" Cursor="SizeNWSE" Grid.Row="3" Grid.Column="4" dz:WindowControl.Hotspot="ResizeRightBottom" /> </Grid> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsKeyboardFocusWithin" Value="True"> <Setter Property="Fill" TargetName="CaptionRectangle" Value="{StaticResource ActiveCaptionBrush}" /> </Trigger> <Trigger Property="IsKeyboardFocusWithin" Value="False"> <Setter Property="Fill" TargetName="CaptionRectangle" Value="{StaticResource InactiveCaptionBrush}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="{x:Type dz:WindowControl}"> <Setter Property="Template" Value="{StaticResource WindowControlTemplate}" /> </Style> </Window.Resources> <dz:WindowPanel> <dz:WindowControl Width="300" Height="200"> <TextBox Text="Window1" /> </dz:WindowControl> <dz:WindowControl Width="300" Height="200"> <TextBox Text="Window2" /> </dz:WindowControl> </dz:WindowPanel> </Window>
See Also