<Window x:Class="ZuneModdingHelper.AppWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:zmh="clr-namespace:ZuneModdingHelper"
        xmlns:zmhc="clr-namespace:ZuneModdingHelper.Controls"
        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
        xmlns:b="clr-namespace:ZuneModdingHelper.Behaviors"
        mc:Ignorable="d"
        WindowStyle="None"
        Title="{x:Static zmh:App.Title}" Height="475" Width="800" WindowStartupLocation="CenterScreen">

    <WindowChrome.WindowChrome>
        <WindowChrome CaptionHeight="52" CornerRadius="0"
                      ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
    </WindowChrome.WindowChrome>

    <Window.Resources>
        <Style x:Key="TitleBarButtonStyle" TargetType="zmhc:PathButton" BasedOn="{StaticResource DefaultPathButtonStyle}">
            <Setter Property="Foreground" Value="{DynamicResource WindowTextBrush}"/>
            <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="Width" Value="32"/>
            <Setter Property="Padding" Value="12"/>
        </Style>
        <Style x:Key="PivotButtonStyle" TargetType="zmhc:TextButton" BasedOn="{StaticResource DefaultTextButtonStyle}">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="AllowUncheck" Value="False"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
        </Style>

        <Storyboard x:Key="DialogExitAnimation" x:Name="DialogExitAnimation">
            <DoubleAnimation Storyboard.TargetProperty="Opacity"
                             From="1.0" To="0.0" Duration="0:0:0.25" />
        </Storyboard>
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="24"/>
            <RowDefinition Height="53"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Border x:Name="BackgroundBorder" Grid.RowSpan="3">
            <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,100" MappingMode="Absolute">
                    <GradientStop x:Name="BackgroundStop0" Color="#5CE851B5" Offset="0"/>
                    <GradientStop x:Name="BackgroundStop1" Color="#00E851B5" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
        </Border>

        <StackPanel Grid.Row="0" Grid.RowSpan="2" Orientation="Horizontal" Panel.ZIndex="128"
                    HorizontalAlignment="Right" VerticalAlignment="Top">
            <zmhc:PathButton ToolTip="Minimize"
                             Style="{StaticResource TitleBarButtonStyle}" Click="MinimizeButton_Click"
                             PathData="m 0.26355 1.58337 l 0.004006 0.532267 H 0.471855 H 1.91237 H 2.11667 L 2.11266 1.58337 Z m 1.64481 0 H 0.467849 Z"/>
            <zmhc:PathButton ToolTip="Maximize"
                             Style="{StaticResource TitleBarButtonStyle}" Click="MaximizeButton_Click"
                             PathData="M 0 0 V 0.5302 V 1.85208 V 2.11563 H 0.26355 H 2.12183 H 2.38538 V 1.85208 V 0 Z M 0.26355 0.5302 H 2.12183 V 1.85208 H 0.26355 Z"/>
            <zmhc:PathButton ToolTip="Close"
                             Style="{StaticResource TitleBarButtonStyle}" Click="CloseButton_Click"
                             PathData="M 0,0 0.8583455,0.8598959 0,1.7197917 h 0.3813721 l 0.6676595,-0.668693 0.6676595,0.668693 h 0.381372 L 1.2397176,0.8598959 2.0980631,0 H 1.7166911 L 1.0490316,0.6686931 0.3813721,0 Z"/>
        </StackPanel>

        <Button Grid.RowSpan="2" Width="36" Height="35" Margin="0,0,110,0"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                WindowChrome.IsHitTestVisibleInChrome="True"  Click="TileButton_Click">
            <Button.Template>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <Border Width="34" Height="34" VerticalAlignment="Top" HorizontalAlignment="Center"
                                Background="{StaticResource ZunePinkBrush}">
                            <Path VerticalAlignment="Center" HorizontalAlignment="Center"
                                  Fill="White" Data="M8.545 19.727C8.545 22.086 6.631 24 4.273 24 1.914 24 0 22.086 0 19.727 0 17.369 1.914 15.455 4.273 15.455L9.965 9.762C9.591 8.754 9.435 7.64 9.554 6.478 9.878 3.322 12.309.713 15.426.125 16.489-.075 17.511-.026 18.461.207 18.847.302 18.972.793 18.69 1.074L16.083 3.681C14.913 4.851 14.913 6.747 16.083 7.917 17.253 9.087 19.149 9.087 20.319 7.917L22.925 5.31C23.207 5.029 23.697 5.154 23.792 5.54 24.026 6.489 24.075 7.51 23.875 8.573 23.288 11.691 20.68 14.122 17.524 14.446 16.361 14.565 15.246 14.409 14.238 14.035L8.545 19.727ZM4.273 16.955C2.742 16.955 1.5 18.197 1.5 19.727 1.5 21.258 2.742 22.5 4.273 22.5 5.803 22.5 7.045 21.258 7.045 19.727 7.045 18.197 5.803 16.955 4.273 16.955ZM22.462 7.895 21.379 8.978C19.624 10.733 16.778 10.733 15.022 8.978 13.267 7.222 13.267 4.376 15.022 2.621L16.105 1.538C15.972 1.554 15.839 1.574 15.704 1.599 13.234 2.065 11.303 4.129 11.047 6.631 10.672 10.282 13.72 13.329 17.371 12.954 19.872 12.697 21.936 10.766 22.401 8.295 22.426 8.161 22.446 8.028 22.462 7.895Z"/>
                        </Border>
                        <Border x:Name="TileHoverOverlay" Opacity="0"
                                BorderBrush="#6E000000" BorderThickness="1,0,1,1">
                            <Border.Background>
                                <RadialGradientBrush GradientOrigin="0.22,0.22" Center="0.22,0.22">
                                    <GradientStop Color="#AD9C9C9C" Offset="0"/>
                                    <GradientStop Color="#73000000" Offset="1"/>
                                </RadialGradientBrush>
                            </Border.Background>
                        </Border>
                        <Border x:Name="TilePressedOverlay" Opacity="0"
                                BorderBrush="#50FFFFFF" BorderThickness="1,0,1,1">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0.5,0.5" SpreadMethod="Reflect">
                                    <GradientStop Color="#05FFFFFF" Offset="0.0"/>
                                    <GradientStop Color="#60FFFFFF" Offset="0.5"/>
                                    <GradientStop Color="#80FFFFFF" Offset="1.0"/>
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TileHoverOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.15" To="0"/>
                                        <DoubleAnimation Storyboard.TargetName="TilePressedOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.15" To="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TileHoverOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.15" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="TilePressedOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.15" To="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TileHoverOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.075" To="0"/>
                                        <DoubleAnimation Storyboard.TargetName="TilePressedOverlay" Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.075" To="1"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard></Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Button.Template>
        </Button>

        <Border Grid.Row="1" BorderThickness="16,0,0,0"
                HorizontalAlignment="Left" Padding="20,0,0,0"
                BorderBrush="{StaticResource ZuneVerticalGradient}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <TextBlock Text="zune modding helper" Grid.RowSpan="2" Margin="0,-6,0,0"
                           Foreground="{StaticResource ZuneMediumTextBrush}"
                           FontSize="28" FontWeight="Light" />

                <Grid x:Name="Pivot" Grid.Row="1" VerticalAlignment="Bottom">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="36"/>
                        <ColumnDefinition Width="74"/>
                        <ColumnDefinition Width="40"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <zmhc:TextButton Text="MODS" Grid.Column="0"
                                     Style="{StaticResource PivotButtonStyle}" />
                    <zmhc:TextButton Text="SETTINGS" Grid.Column="1"
                                     Style="{StaticResource PivotButtonStyle}" />
                    <zmhc:TextButton Text="ABOUT" Grid.Column="2"
                                     Style="{StaticResource PivotButtonStyle}" />

                    <i:Interaction.Behaviors>
                        <b:FadeAnimateItemsPanelBehavior Tick="0:0:0.05">
                            <b:FadeAnimateItemsPanelBehavior.Animation>
                                <DoubleAnimation From="0" To="1" Duration="0:0:0.3"/>
                            </b:FadeAnimateItemsPanelBehavior.Animation>
                        </b:FadeAnimateItemsPanelBehavior>
                    </i:Interaction.Behaviors>
                </Grid>
            </Grid>
        </Border>

        <Border x:Name="ContentBorder" Grid.Row="2" Padding="36,16,36,36">
            <ContentControl x:Name="ContentFrame">
                <ContentControl.RenderTransform>
                    <TranslateTransform/>
                </ContentControl.RenderTransform>
                <b:ContentControlExtensions.ContentChangedAnimation>
                    <Storyboard x:Name="ContentEntranceAnimation">
                        <DoubleAnimation From="-32" To="0" Duration="0:0:0.5" Storyboard.TargetProperty="RenderTransform.X">
                            <DoubleAnimation.EasingFunction>
                                <QuadraticEase EasingMode="EaseOut"/>
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                        <DoubleAnimation From="0" To="1.0" Duration="0:0:0.1" Storyboard.TargetProperty="Opacity"/>
                    </Storyboard>
                </b:ContentControlExtensions.ContentChangedAnimation>
            </ContentControl>
        </Border>

        <ContentControl x:Name="DialogPresenter" Grid.RowSpan="3" IsHitTestVisible="False"/>
    </Grid>

</Window>
