<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/Button.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="RubyerMessageBoxCard" TargetType="{x:Type bpa:MessageBoxCard}">
        <Setter Property="Background" Value="{DynamicResource FloatBackground}" />
        <Setter Property="BorderBrush" Value="{Binding ThemeColorBrush, RelativeSource={RelativeSource Self}}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
        <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="MaxWidth" Value="460" />
        <Setter Property="MessageBoxButton" Value="OK" />
        <Setter Property="MinHeight" Value="120" />
        <Setter Property="MinWidth" Value="250" />
        <Setter Property="Padding" Value="10" />
        <Setter Property="ShowShadow" Value="True" />
        <Setter Property="IsShow" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="ThemeColorBrush" Value="{DynamicResource Info}" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="bpa:HeaderHelper.Background" Value="{Binding Background, RelativeSource={RelativeSource Self}}" />
        <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
        <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
        <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
        <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
        <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Center" />
        <Setter Property="bpa:HeaderHelper.Padding" Value="10 5" />
        <Setter Property="bpa:HeaderHelper.CornerRadius" Value="{DynamicResource TopContainerCornerRadius}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type bpa:MessageBoxCard}">
                    <bpa:Transition x:Name="Path_Transition"
                                    InitialScale="0.5"
                                    IsShow="{TemplateBinding IsShow}"
                                    Type="Zoom">
                        <Grid x:Name="root">
                            <Border x:Name="effectBorder"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    Effect="{DynamicResource AllDirectionEffect3}"
                                    Visibility="{TemplateBinding ShowShadow, Converter={StaticResource BooleanToVisibleConverter}}" />
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Border x:Name="titleBorder"
                                            Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                            CornerRadius="{Binding (bpa:HeaderHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                        <TextBlock x:Name="title"
                                                   Margin="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                                   Text="{TemplateBinding Title}" />
                                    </Border>

                                    <Grid Grid.Row="1" Margin="{TemplateBinding Padding}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <bpa:Icon x:Name="icon"
                                                  Grid.Column="0"
                                                  Margin="5"
                                                  Foreground="{TemplateBinding ThemeColorBrush}">
                                            <bpa:Icon.Width>
                                                <MultiBinding Converter="{StaticResource MathAddConverter}">
                                                    <Binding Path="FontSize" RelativeSource="{RelativeSource Self}" />
                                                    <Binding Source="18" />
                                                </MultiBinding>
                                            </bpa:Icon.Width>
                                        </bpa:Icon>
                                        <TextBlock Grid.Column="1"
                                                   Margin="5 0"
                                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                   Focusable="False"
                                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                   Text="{TemplateBinding Message}"
                                                   TextWrapping="Wrap" />
                                    </Grid>
                                    <StackPanel Grid.Row="2"
                                                Margin="{TemplateBinding Padding}"
                                                HorizontalAlignment="Right"
                                                bpa:PanelHelper.Spacing="10"
                                                Orientation="Horizontal">
                                        <Button x:Name="PART_YesButton"
                                                MinWidth="60"
                                                Content="{DynamicResource I18N_MessageBox_Yes}"
                                                Visibility="Collapsed" />
                                        <Button x:Name="PART_NoButton"
                                                MinWidth="60"
                                                Background="{DynamicResource Info}"
                                                Content="{DynamicResource I18N_MessageBox_No}"
                                                Visibility="Visible" />
                                        <Button x:Name="PART_OkButton"
                                                MinWidth="60"
                                                Content="{DynamicResource I18N_MessageBox_Ok}"
                                                Visibility="Collapsed" />
                                        <Button x:Name="PART_CancelButton"
                                                MinWidth="60"
                                                Background="{DynamicResource Info}"
                                                Content="{DynamicResource I18N_MessageBox_Cancel}"
                                                Visibility="Collapsed" />
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                    </bpa:Transition>
                    <ControlTemplate.Triggers>
                        <Trigger Property="MessageBoxButton" Value="OK">
                            <Setter TargetName="PART_OkButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_YesButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_NoButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CancelButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_OkButton" Property="IsDefault" Value="True" />
                        </Trigger>
                        <Trigger Property="MessageBoxButton" Value="OKCancel">
                            <Setter TargetName="PART_OkButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_YesButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_NoButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_CancelButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_OkButton" Property="IsDefault" Value="True" />
                        </Trigger>
                        <Trigger Property="MessageBoxButton" Value="YesNo">
                            <Setter TargetName="PART_OkButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_YesButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_NoButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_CancelButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_YesButton" Property="IsDefault" Value="True" />
                        </Trigger>
                        <Trigger Property="MessageBoxButton" Value="YesNoCancel">
                            <Setter TargetName="PART_OkButton" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_YesButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_NoButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_CancelButton" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_CancelButton" Property="IsDefault" Value="True" />
                        </Trigger>
                        <Trigger Property="Type" Value="None">
                            <Setter TargetName="icon" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Type" Value="Info">
                            <Setter TargetName="icon" Property="Type" Value="InformationFill" />
                            <Setter Property="ThemeColorBrush" Value="{DynamicResource Info}" />
                            <Setter Property="Title" Value="{StaticResource I18N_Info}" />
                        </Trigger>
                        <Trigger Property="Type" Value="Question">
                            <Setter TargetName="icon" Property="Type" Value="QuestionFill" />
                            <Setter Property="ThemeColorBrush" Value="{DynamicResource Question}" />
                            <Setter Property="Title" Value="{StaticResource I18N_Question}" />
                        </Trigger>
                        <Trigger Property="Type" Value="Warning">
                            <Setter TargetName="icon" Property="Type" Value="ErrorWarningFill" />
                            <Setter Property="ThemeColorBrush" Value="{DynamicResource Warning}" />
                            <Setter Property="Title" Value="{StaticResource I18N_Warning}" />
                        </Trigger>
                        <Trigger Property="Type" Value="Success">
                            <Setter TargetName="icon" Property="Type" Value="CheckboxCircleFill" />
                            <Setter Property="ThemeColorBrush" Value="{DynamicResource Success}" />
                            <Setter Property="Title" Value="{StaticResource I18N_Success}" />
                        </Trigger>
                        <Trigger Property="Type" Value="Error">
                            <Setter TargetName="icon" Property="Type" Value="CloseCircleFill" />
                            <Setter Property="ThemeColorBrush" Value="{DynamicResource Error}" />
                            <Setter Property="Title" Value="{StaticResource I18N_Error}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>