<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="450" 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="FontFamily" Value="segoe zuc"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="AllowUncheck" Value="False"/>
        </Style>
    </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>

        <Border Width="32" Height="32" Grid.RowSpan="2" Background="#F10DA2" IsHitTestVisible="False"
                HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,110,0">
            <Path Fill="White" Data="M12.545,23.727C12.545,26.086 10.631,28 8.273,28C5.914,28 4,26.086 4,23.727C4,21.369 5.914,19.455 8.273,19.455L13.965,13.762C13.591,12.754 13.435,11.64 13.554,10.478C13.878,7.322 16.309,4.713 19.426,4.125C20.489,3.925 21.511,3.974 22.461,4.207C22.847,4.302 22.972,4.793 22.69,5.074L20.083,7.681C18.913,8.851 18.913,10.747 20.083,11.917C21.253,13.087 23.149,13.087 24.319,11.917L26.925,9.31C27.207,9.029 27.697,9.154 27.792,9.54C28.026,10.489 28.075,11.51 27.875,12.573C27.288,15.691 24.68,18.122 21.524,18.446C20.361,18.565 19.246,18.409 18.238,18.035L12.545,23.727ZM8.273,20.955C6.742,20.955 5.5,22.197 5.5,23.727C5.5,25.258 6.742,26.5 8.273,26.5C9.803,26.5 11.045,25.258 11.045,23.727C11.045,22.197 9.803,20.955 8.273,20.955ZM26.462,11.895L25.379,12.978C23.624,14.733 20.778,14.733 19.022,12.978C17.267,11.222 17.267,8.376 19.022,6.621L20.105,5.538C19.972,5.554 19.839,5.574 19.704,5.599C17.234,6.065 15.303,8.129 15.047,10.631C14.672,14.282 17.72,17.329 21.371,16.954C23.872,16.697 25.936,14.766 26.401,12.295C26.426,12.161 26.446,12.028 26.462,11.895Z"/>
        </Border>

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

                <TextBlock Text="{x:Static zmh:App.Title}" Grid.RowSpan="2"
                           Foreground="#3C3C3C" FontSize="28" FontFamily="segoe zlc" Margin="0,-6,0,0" />

                <StackPanel x:Name="Pivot" Grid.Row="1" VerticalAlignment="Bottom" Orientation="Horizontal">
                    <zmhc:TextButton Text="Mods" Grid.Column="0" Width="36"
                                     Style="{StaticResource PivotButtonStyle}" />
                    <zmhc:TextButton Text="Settings" Grid.Column="1" Width="58" Margin="6,0,0,0"
                                     Style="{StaticResource PivotButtonStyle}" />
                    <zmhc:TextButton Text="About" Grid.Column="2" Margin="6,0,0,0"
                                     Style="{StaticResource PivotButtonStyle}" />
                </StackPanel>
            </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>
                        <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>
    </Grid>

</Window>
