WindowPanel Class

DevZest WPF Docking

WindowPanel Class
Defines an area where you can position child WindowControl elements.
Inheritance Hierarchy
SystemObject  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.Windows.MediaVisual
        System.WindowsUIElement
          System.WindowsFrameworkElement
            System.Windows.ControlsPanel
              DevZest.WindowsWindowPanel

Namespace: DevZest.Windows
Assembly: DevZest.WpfDocking (in DevZest.WpfDocking.dll) Version: 2.5.0.0 (2.5.5912.0)
Syntax
public class WindowPanel : Panel
Public Class WindowPanel
	Inherits Panel

The WindowPanel type exposes the following members.

Constructors
  NameDescription
Public methodWindowPanel
Initializes a new instance of the WindowPanel class
Top
Methods
  NameDescription
Protected methodGetDefaultLocation
Gets the default location for specified WindowControl.
Top
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