<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:assist="clr-namespace:SmartUI.Assist"
                    xmlns:smart="clr-namespace:SmartUI.Controls">
    <Style x:Key="DefaultWindowStyle" TargetType="{x:Type smart:SmartWindow}">
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="ResizeMode" Value="NoResize"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type smart:SmartWindow}">
                    <Border x:Name="border" Background="{DynamicResource BgWhiteColor}"  Margin="0 0 8 8" BorderBrush="{DynamicResource BorderLightColor}" BorderThickness="1">
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="8" Color="LightGray" Opacity="0.1"/>
                        </Border.Effect>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="35"/>
                                <RowDefinition Height="6"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <DockPanel LastChildFill="True" Grid.Row="0">
                                <StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
                                    <Button assist:ButtonAssist.Icon="WindowMinimize" Command="SystemCommands.MinimizeWindowCommand" Style="{DynamicResource WindowButtonStyle}"/>
                                    <Button x:Name="restore" assist:ButtonAssist.Icon="WindowRestore" Command="SystemCommands.RestoreWindowCommand" Style="{DynamicResource WindowButtonStyle}" Visibility="Collapsed"/>
                                    <Button x:Name="maximize" assist:ButtonAssist.Icon="WindowMaximize" Command="SystemCommands.MaximizeWindowCommand" Style="{DynamicResource WindowButtonStyle}"/>
                                    <Button assist:ButtonAssist.Icon="WindowClose" Command="SystemCommands.CloseWindowCommand" Style="{DynamicResource WindowButtonStyle}"/>
                                </StackPanel>
                                <Grid>
                                    <Border x:Name="titleControl" Background="Transparent" Visibility="Visible"/>
                                    <DockPanel x:Name="titleDock" LastChildFill="True" Visibility="Collapsed">
                                        <Image x:Name="icon" DockPanel.Dock="Left" Source="{TemplateBinding Icon}" Width="22" Height="22" VerticalAlignment="Center" Margin="5 0 0 0"/>
                                        <Label x:Name="title" Content="{TemplateBinding Title}" VerticalAlignment="Center" Padding="5 0" FontSize="14" FontWeight="ExtraBlack"/>
                                    </DockPanel>
                                </Grid>
                                
                            </DockPanel>
                            <Rectangle Height="6" Grid.Row="1">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <GradientStop Color="#CCCCCC" Offset="0.0" />
                                        <GradientStop Color="#DDDDDD" Offset="0.1" />
                                        <GradientStop Color="#FAFAFA" Offset="0.5" />
                                        <GradientStop Color="White" Offset="1.0" />
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Grid Grid.Row="2">
                                <AdornerDecorator>
                                    <ContentPresenter></ContentPresenter>
                                </AdornerDecorator>
                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Icon" Value="{x:Null}">
                            <Setter TargetName="icon" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter TargetName="border" Property="Effect" Value="{x:Null}"/>
                            <Setter TargetName="border" Property="Margin" Value="0"/>
                            <Setter TargetName="maximize" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="restore" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="WindowState" Value="Normal">
                            <Setter TargetName="maximize" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="restore" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="TitleControl" Value="{x:Null}">
                            <Setter TargetName="titleControl" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="titleDock" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="smart:SmartWindow" BasedOn="{StaticResource DefaultWindowStyle}"/>
    <Style x:Key="WindowButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="50"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="{TemplateBinding Background}">
                        <smart:PackIcon Kind="{TemplateBinding assist:ButtonAssist.Icon}" Width="16" Height="16"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="#EEEEF2"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="assist:ButtonAssist.Icon" Value="WindowClose"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="#D32424"/>
                            <Setter Property="Foreground" Value="White"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>