<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:bpa="clr-namespace:BPA.UIControl">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="bpa:MessageBoxContainer">
        <Setter Property="Background" Value="{DynamicResource DefaultBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
        <Setter Property="MaskBackground" Value="{DynamicResource DialogBackground}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="IsShow" Value="False" />
        <Setter Property="IsClosed" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type bpa:MessageBoxContainer}">
                    <Grid>
                        <ContentPresenter x:Name="PART_ContentPresenter"
                                          Panel.ZIndex="1"
                                          Focusable="False"
                                          RecognizesAccessKey="True"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

                        <bpa:Transition x:Name="Path_Transition"
                                        Panel.ZIndex="100"
                                        IsShow="{TemplateBinding IsShow}">
                            <Border x:Name="PART_RootBorder" Background="{TemplateBinding MaskBackground}">
                                <ContentPresenter x:Name="PART_DialogContentPresenter"
                                                  Grid.Row="1"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  Content="{TemplateBinding DialogContent}"
                                                  ContentSource="DialogContent"
                                                  Focusable="True"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Border>
                        </bpa:Transition>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsShow" Value="False" />
                                <Condition Property="IsClosed" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Path_Transition" Property="Panel.ZIndex" Value="0" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>