<UserControl x:Class="ZuneModdingHelper.Controls.ZuneLightDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ZuneModdingHelper.Controls"
             xmlns:zmhm="clr-namespace:ZuneModdingHelper.Messages"
             VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <d:UserControl.DataContext>
        <zmhm:DialogViewModel/>
    </d:UserControl.DataContext>

    <Border Background="#AFFFFFFF">
        <Border x:Name="DialogBorder" MaxHeight="400" MaxWidth="528"
                Padding="32" VerticalAlignment="Center"
                RenderTransformOrigin="0.5,0.5">
            <Border.Background>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFFFFF" Offset="0"/>
                    <GradientStop Color="#F0F0F0" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            
            <Border.RenderTransform>
                <ScaleTransform />
            </Border.RenderTransform>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <Rectangle Height="5" Width="109" Margin="0,-16,0,0" Grid.ColumnSpan="2"
                           VerticalAlignment="Top" HorizontalAlignment="Left"
                           Fill="{StaticResource ZuneHorizontalGradientAlt}"/>
                <TextBlock Text="{Binding Title}" d:Text="WINDOWS LIVE ID" FontSize="28" Margin="0,-10,0,12"
                           Foreground="{StaticResource ZuneMediumTextBrush}"
                           Visibility="{Binding Title, Converter={StaticResource NotNullToVis}}"/>

                <StackPanel Grid.Row="1" Grid.ColumnSpan="2">
                    <local:SelectableTextBlock Text="{Binding Description}" FontSize="14" TextWrapping="Wrap" Margin="0,0,0,12"
                                               Foreground="{StaticResource ZuneLightTextBrush}"/>
                    <ContentControl x:Name="InnerPresenter" />
                </StackPanel>

                <Button Grid.Row="2" HorizontalAlignment="Right"
                        FontSize="12" Height="24"
                        Content="{Binding AffirmativeText}"
                        Visibility="{Binding ShowAffirmativeButton, Converter={StaticResource BoolToVis}}"
                        Command="{Binding OnAction}" CommandParameter="{StaticResource TrueValue}"
                        Style="{StaticResource ActionButtonStyle}"/>

                <Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right"
                        FontSize="12" Height="24" Margin="12,0,0,0"
                        Content="{Binding NegativeText}"
                        Visibility="{Binding ShowNegativeButton, Converter={StaticResource BoolToVis}}"
                        Command="{Binding OnAction}" CommandParameter="{StaticResource FalseValue}"
                        Style="{StaticResource ActionButtonStyle}"/>
            </Grid>

            <Border.Effect>
                <DropShadowEffect Color="Black" Opacity="0.45" BlurRadius="8"
                                  Direction="0" ShadowDepth="0"/>
            </Border.Effect>
        </Border>

        <Border.Triggers>
            <EventTrigger RoutedEvent="Loaded">
                <BeginStoryboard>
                    <Storyboard x:Name="DialogEntranceAnimation">
                        <DoubleAnimation From="0.9" To="1.0" Duration="0:0:0.25"
                                         Storyboard.TargetName="DialogBorder" Storyboard.TargetProperty="RenderTransform.ScaleX">
                            <DoubleAnimation.EasingFunction>
                                <BackEase EasingMode="EaseOut" Amplitude="0.5" />
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                        <DoubleAnimation From="0.9" To="1.0" Duration="0:0:0.25"
                                         Storyboard.TargetName="DialogBorder" Storyboard.TargetProperty="RenderTransform.ScaleY">
                            <DoubleAnimation.EasingFunction>
                                <BackEase EasingMode="EaseOut" Amplitude="0.5" />
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                        
                        <DoubleAnimation From="0" To="1.0" Duration="0:0:0.2" Storyboard.TargetProperty="Opacity"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Border.Triggers>
    </Border>

</UserControl>
