1

I need to create a window that has the following properties and behaviors:

  • Outer resize border of the window:

    Animation of border behavior

  • 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>

Martin Liversage
  • 104,481
  • 22
  • 209
  • 256
D .Stark
  • 145
  • 11
  • Possible duplicate of [WPF window shadow effect](https://stackoverflow.com/questions/13367249/wpf-window-shadow-effect) – Sinatr Sep 20 '17 at 11:13
  • > 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 :) – D .Stark Sep 20 '17 at 18:53

0 Answers0