<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:HandyControl.Controls"
                    xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
                    xmlns:langs="clr-namespace:HandyControl.Properties.Langs">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Button.xaml"/>
        <ResourceDictionary Source="../Basic/Converters.xaml"/>
        <ResourceDictionary Source="../Basic/Paths.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="controls:PopupWindow">
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="MinHeight" Value="220"/>
        <Setter Property="BorderThickness" Value="20"/>
        <Setter Property="ShowInTaskbar" Value="False"/>
        <Setter Property="MinWidth" Value="300"/>
        <Setter Property="ResizeMode" Value="NoResize"/>
        <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
        <Setter Property="SizeToContent" Value="WidthAndHeight"/>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect Opacity=".6" ShadowDepth="0" BlurRadius="15"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PopupWindow">
                    <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid Name="TitleGrid" Height="30" Background="{DynamicResource TitleBrush}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Name="PART_TitleBlock" Background="Transparent" Padding="10,6" Foreground="White" Text="{TemplateBinding Title}" VerticalAlignment="Center" TextWrapping="Wrap" TextTrimming="WordEllipsis"/>
                                <Button Margin="0,0,1,0" Background="Transparent" Name="CloseButton" Foreground="White" Grid.Column="1" controls:BackgroundSwitchElement.MouseHoverBackground="Red" controls:BackgroundSwitchElement.MouseDownBackground="Red" Command="interactivity:ControlCommands.Close" IsCancel="True" Height="28" Style="{StaticResource ButtonCustom}" Width="44" Padding="9">
                                    <Path Fill="{Binding ElementName=CloseButton,Path=Foreground}" Style="{StaticResource ClosePathStyle}"/>
                                </Button>
                            </Grid>
                            <Border BorderBrush="{DynamicResource TitleBrush}" Name="PART_MainBorder" Grid.Row="1">
                                <StackPanel>
                                    <TextBlock Text="{TemplateBinding ContentStr}" MinHeight="110" Name="MyTextBlock" TextAlignment="Center" Padding="32" Foreground="{DynamicResource PrimaryTextBrush}" MaxWidth="300" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Background="{TemplateBinding Background}"/>
                                    <StackPanel Margin="0,0,0,32" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
                                        <Button IsCancel="True" MinWidth="80" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Visibility="{TemplateBinding ShowCancel,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,16,0"/>
                                        <Button IsDefault="True" MinWidth="80" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Style="{StaticResource ButtonPrimary}"/>
                                    </StackPanel>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ShowBorder" Value="True">
                            <Setter Property="BorderThickness" Value="1,0,1,1" TargetName="PART_MainBorder"/>
                        </Trigger>
                        <Trigger Property="ShowTitle" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="TitleGrid"/>
                            <Setter Property="Background" Value="Transparent"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>