I need to create a window that has the following properties and behaviors:
Outer resize border of the window:
Having a shadow (custom, not standart)
- Standart Windows minimize/restore animations
- Custom window template
Let's go by order.
I can set the WindowChrome.ResizeBorderThickness
property for create window shadow, but it does not work as I need it - WindowChrome.ResizeBorderThickness set shadow on the edge of the visible window - it needs to be "abroad" of the window.
If I make the window AllowsTransparency
(and, accordingly, WindowStyle
must be set as None
), it will not support the standard minimize/restore animations.
If make the window transparent - will be possible outer resize border :)
With all this I need my own kind of window - frame, buttons, borders. I redefine the template for this (and give to you a base for experiments):
<Style TargetType="{x:Type Window}">
<Setter Property="ResizeMode" Value="CanResize"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome NonClientFrameEdges="None" CornerRadius="0" GlassFrameThickness="0" ResizeBorderThickness="5" CaptionHeight="30"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border BorderThickness="1" BorderBrush="DarkGray" Background="#F0F0F0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- TitleBar -->
<Border Background="White" Grid.Row="0"/>
<!-- Window content -->
<AdornerDecorator Grid.Row="1">
<ContentPresenter/>
</AdornerDecorator>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>