<!--***********************************************************************************

   Extended WPF Toolkit

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  **********************************************************************************-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
                    xmlns:prim="clr-namespace:Xceed.Wpf.Toolkit.Primitives">

    <ResourceDictionary.MergedDictionaries>
         <ResourceDictionary Source="../../Themes/Generic/Common.xaml" />
         <ResourceDictionary Source="../../Primitives/Themes/Generic/WindowControl.xaml" />
    </ResourceDictionary.MergedDictionaries>

   <!-- =============================================================================== -->
   <!-- MessageBox                                                                      -->
   <!-- =============================================================================== -->

    <Style TargetType="{x:Type local:MessageBox}" BasedOn="{StaticResource {x:Type prim:WindowControl}}">
        <Setter Property="ButtonRegionBackground" Value="#FFF0F0F0" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="MinWidth" Value="350" />
        <Setter Property="MinHeight" Value="50" />
        <Setter Property="MaxHeight" Value="250" />
        <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type local:MessageBox}">
             <Grid>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="group1">
                        <VisualState x:Name="OK">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_OkButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="OKCancel">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_OkButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CancelButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="YesNo">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_YesButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_NoButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="YesNoCancel">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_YesButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_NoButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CancelButton" Storyboard.TargetProperty="Visibility">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>

                <prim:WindowControl x:Name="PART_WindowControl"
                                    Caption="{TemplateBinding Caption}"
                                    CaptionFontSize="{TemplateBinding CaptionFontSize}"
                                    CaptionForeground="{TemplateBinding CaptionForeground}"
                                    CaptionShadowBrush="{TemplateBinding CaptionShadowBrush}"
                                    CaptionIcon="{TemplateBinding CaptionIcon}"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    IsActive="{TemplateBinding IsActive}"
                                    WindowBackground="{TemplateBinding WindowBackground}"
                                    WindowInactiveBackground="{TemplateBinding WindowInactiveBackground}" 
                                    WindowBorderBrush="{TemplateBinding WindowBorderBrush}"
                                    WindowBorderThickness="{TemplateBinding WindowBorderThickness}"
                                    CloseButtonStyle="{TemplateBinding CloseButtonStyle}"
                                    WindowOpacity="{TemplateBinding WindowOpacity}">
                    <prim:WindowControl.Content>
                        <Grid MinWidth="350">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Grid Margin="24,16,24,22">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <!-- Message Image -->
                                <Image x:Name="MessageBoxImage" 
                                       VerticalAlignment="Top" 
                                       SnapsToDevicePixels="True" 
                                       Stretch="None"
                                       Source="{TemplateBinding ImageSource}" />

                                <!-- Message Text -->
                                <ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Auto">
                                    <TextBlock x:Name="MessageText" 
                                               TextWrapping="Wrap"
                                               VerticalAlignment="Center" 
                                               MaxWidth="450" 
                                               Text="{TemplateBinding Text}" 
                                               FontFamily="{TemplateBinding FontFamily}" 
                                               FontSize="{TemplateBinding FontSize}" 
                                               FontStyle="{TemplateBinding FontStyle}" 
                                               FontWeight="{TemplateBinding FontWeight}" 
                                               Foreground="{TemplateBinding Foreground}"
                                               Margin="10,0,0,0"/>
                                </ScrollViewer>
                            </Grid>

                            <!-- Buttons -->
                            <Border Grid.Row="1" Background="{TemplateBinding ButtonRegionBackground}">
                                <Grid HorizontalAlignment="Right" Margin="12">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>

                                    <Button Grid.Column="0" x:Name="PART_YesButton" MinWidth="65" Margin="6,0,0,0" Visibility="Collapsed" Content="{TemplateBinding YesButtonContent}" Style="{TemplateBinding YesButtonStyle}" />
                                    <Button Grid.Column="1" x:Name="PART_NoButton" MinWidth="65" Margin="6,0,0,0" Visibility="Collapsed" Content="{TemplateBinding NoButtonContent}" Style="{TemplateBinding NoButtonStyle}" />
                                    <Button Grid.Column="2" x:Name="PART_OkButton" MinWidth="65" Margin="6,0,0,0" Visibility="Collapsed" Content="{TemplateBinding OkButtonContent}" Style="{TemplateBinding OkButtonStyle}" />
                                    <Button Grid.Column="3" x:Name="PART_CancelButton" MinWidth="65" Margin="6,0,0,0" Visibility="Collapsed" Content="{TemplateBinding CancelButtonContent}" Style="{TemplateBinding CancelButtonStyle}" IsCancel="True" />
                                </Grid>
                            </Border>
                         </Grid>
                    </prim:WindowControl.Content>
                </prim:WindowControl>
              </Grid>
           </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

</ResourceDictionary>
