<Page
  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:system="clr-namespace:System;assembly=mscorlib"
  xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
  xmlns:noesis="clr-namespace:NoesisGUIExtensions"
  mc:Ignorable="d"
  d:DesignWidth="1920"
  d:DesignHeight="1080"
  Background="#FF4D5052" d:DataContext="MyDataSet">
  <b:Interaction.Triggers>
    <b:EventTrigger x:Name="OnLoad_SetFocusOnListBox">
      <noesis:SetFocusAction TargetName="CharacterGrid_ListBox"/>
    </b:EventTrigger>
    <b:DataTrigger x:Name="OnPurchase_PurchaseCelebration" Binding="{Binding Path=SelectedItem.IsOwned, ElementName=CharacterGrid_ListBox}" Value="True">
      <b:ControlStoryboardAction Storyboard="{DynamicResource PurchaseCelebrationEffect}"/>
    </b:DataTrigger>
  </b:Interaction.Triggers>
  <Page.Resources>
    <ResourceDictionary>
      <Storyboard x:Key="PurchaseCelebrationEffect" FillBehavior="Stop">
        <Storyboard.Events>
          <b:StoryboardEvent Time="00:00:00">
            <noesis:PlayMediaAction TargetName="Starbust_MediaElement"/>
          </b:StoryboardEvent>
          <b:StoryboardEvent Time="0:0:1">
            <noesis:RewindMediaAction TargetName="Starbust_MediaElement"/>
          </b:StoryboardEvent>
        </Storyboard.Events>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Starbust_MediaElement" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
        </ObjectAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Starbust_MediaElement" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.9000000" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Blurrer" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
        </ObjectAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background_Blurrer" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.9000000" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CharacterName_TextBlock" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
        </ObjectAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CharacterName_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="1.5"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CharacterName_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="1.5"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="AcquiredText_TextBlock" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="0:0:0.300" Value="{x:Static Visibility.Visible}"/>
        </ObjectAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="AcquiredText_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.300" Value="1.5"/>
          <LinearDoubleKeyFrame KeyTime="0:0:0.400" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="AcquiredText_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.300" Value="1.5"/>
          <LinearDoubleKeyFrame KeyTime="0:0:0.400" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CharacterName_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.800" Value="0"/>
          <LinearDoubleKeyFrame KeyTime="0:0:1" Value="-512"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CharacterName_TextBlock" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.800" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="AcquiredText_TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.800" Value="0"/>
          <LinearDoubleKeyFrame KeyTime="0:0:1" Value="512"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="AcquiredText_TextBlock" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="0:0:0.800" Value="1"/>
          <LinearDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background_Darkener" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
        </ObjectAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background_Darkener" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.66"/>
          <LinearDoubleKeyFrame KeyTime="00:00:00.9000000" Value="0.66"/>
          <LinearDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
      </Storyboard>
    </ResourceDictionary>
  </Page.Resources>
  <Grid x:Name="Master_Grid">
    <Grid x:Name="Interface_Grid">
      <Grid x:Name="Background_Grid">
        <Border x:Name="Background_Solid_Border">
          <Border.Background>
            <SolidColorBrush Color="{DynamicResource Base_3}"/>
          </Border.Background>
        </Border>
        <Grid x:Name="Video_Grid">
          <MediaElement x:Name="Starbust_MediaElement" Source="Assets/Video_Starburst.mp4" Stretch="UniformToFill" LoadedBehavior="Manual" Visibility="Hidden" BlendingMode="Screen">
            <MediaElement.Effect>
              <noesis:VignetteEffect Strength="4"/>
            </MediaElement.Effect>
          </MediaElement>
        </Grid>
      </Grid>
      <Grid x:Name="Layout_Grid">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="64"/>
          <ColumnDefinition Width="3*"/>
          <ColumnDefinition Width="1*"/>
          <ColumnDefinition Width="64"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="32"/>
          <RowDefinition Height="835*"/>
          <RowDefinition Height="64"/>
        </Grid.RowDefinitions>
        <Grid x:Name="UnderHeader_Grid" Margin="0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3">
          <Border x:Name="PageGlow_Top_Border">
            <Border.Background>
              <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" Opacity="0.05">
                <GradientStop Color="#00FF89B1" Offset="0.1"/>
                <GradientStop Color="{DynamicResource Primary_1}"/>
              </LinearGradientBrush>
            </Border.Background>
          </Border>
          <Border x:Name="PageGlow_TopRight_Border">
            <Border.Background>
              <LinearGradientBrush StartPoint="1,0" EndPoint="0,1" Opacity="0.1">
                <GradientStop Color="#00FF89B1" Offset="0.50200003"/>
                <GradientStop Color="{DynamicResource Primary_1}"/>
              </LinearGradientBrush>
            </Border.Background>
          </Border>
        </Grid>
        <Grid x:Name="Header_Grid" Grid.ColumnSpan="4">
          <Grid x:Name="Panel_Grid">
            <Border x:Name="Panel_Border">
              <Border.Background>
                <SolidColorBrush Color="{DynamicResource Base_2}"/>
              </Border.Background>
            </Border>
          </Grid>
          <Border x:Name="Content_Border" Padding="32,32,32,32">
            <Grid x:Name="ContentLayout_Grid">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="Auto"/>
              </Grid.ColumnDefinitions>
              <TextBlock Text="RECRUITMENT" FontFamily="Tw Cen MT" FontSize="40" FontWeight="Bold" FontStyle="Italic" TextWrapping="Wrap">
                <TextBlock.Foreground>
                  <SolidColorBrush Color="{DynamicResource Primary_1}"/>
                </TextBlock.Foreground>
              </TextBlock>
              <Grid x:Name="PlayerModule" Column="1">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Margin="0,0,8,0" HorizontalAlignment="Right" VerticalAlignment="Center" FontFamily="Tw Cen MT" FontSize="32" FontWeight="Bold" FontStyle="Italic" TextAlignment="Right" TextWrapping="Wrap">
                  <TextBlock.Foreground>
                    <SolidColorBrush Color="{DynamicResource Primary_2}"/>
                  </TextBlock.Foreground>
                  <Run Text="{Binding Path=User.AccountBalance, StringFormat={}{00#,000}}"/><Run Text=" CREDITS"/>
                </TextBlock>
                <ContentControl Content="ContentControl" Grid.Column="1" ContentTemplate="{DynamicResource PlayerProfile_ContentControl_Content_Template}"/>
              </Grid>
            </Grid>
          </Border>
        </Grid>
        <ListBox x:Name="CharacterGrid_ListBox" ItemsSource="{Binding Path=Characters}" SelectedIndex="0" Grid.Column="1" Grid.Row="2" ItemContainerStyle="{DynamicResource CharacterTile_ListBox_ItemContainer_Style}" ItemsPanel="{DynamicResource CharacterGrid_ListBox_ItemsPanel_Template}" ItemTemplate="{DynamicResource CharacterTile_ListBox_Item_Template}"/>
        <ContentControl x:Name="StatsPanel_ContentControl" Content="{Binding Path=SelectedItem, ElementName=CharacterGrid_ListBox}" Grid.Column="2" Grid.Row="2" ContentTemplate="{DynamicResource StatsPanel_ContentControl_Content_Template}"/>
      </Grid>
    </Grid>
    <Grid x:Name="PopUp_Grid" Grid.ColumnSpan="4" IsHitTestVisible="False" Grid.RowSpan="4">
      <Border x:Name="Background_Blurrer" Visibility="Hidden" Background="#FF000000">
        <b:Interaction.Behaviors>
          <noesis:BackgroundEffectBehavior x:Name="BlurInterface" Source="{Binding ElementName=Layout_Grid}">
            <noesis:BackgroundEffectBehavior.Effect>
              <BlurEffect Radius="8"/>
            </noesis:BackgroundEffectBehavior.Effect>
          </noesis:BackgroundEffectBehavior>
        </b:Interaction.Behaviors>
      </Border>
      <Border x:Name="Background_Darkener" Visibility="Hidden">
        <Border.Background>
          <SolidColorBrush Color="{DynamicResource Base_2}"/>
        </Border.Background>
      </Border>
      <StackPanel x:Name="PopUpContent_VerticalStackPanel" HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBlock x:Name="CharacterName_TextBlock" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" FontFamily="Tw Cen MT" FontSize="128" FontWeight="Bold" FontStyle="Italic" TextAlignment="Center" TextWrapping="Wrap">
          <TextBlock.Foreground>
            <SolidColorBrush Color="{DynamicResource Primary_1}"/>
          </TextBlock.Foreground>
          <TextBlock.Text>
            <Binding Path="SelectedItem.CharacterName" ElementName="CharacterGrid_ListBox">
              <Binding.Converter>
                <noesis:CaseConverter/>
              </Binding.Converter>
            </Binding>
          </TextBlock.Text>
          <TextBlock.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </TextBlock.RenderTransform>
          <TextBlock.Effect>
            <DropShadowEffect Color="{DynamicResource Primary_1}" BlurRadius="128" Direction="90" ShadowDepth="0" Opacity="0.5"/>
          </TextBlock.Effect>
        </TextBlock>
        <TextBlock x:Name="AcquiredText_TextBlock" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" Text="ACQUIRED" FontFamily="Tw Cen MT" FontSize="128" FontWeight="Bold" FontStyle="Italic" TextAlignment="Center" TextWrapping="Wrap">
          <TextBlock.Foreground>
            <SolidColorBrush Color="{DynamicResource Primary_1}"/>
          </TextBlock.Foreground>
          <TextBlock.RenderTransform>
            <TransformGroup>
              <ScaleTransform/>
              <SkewTransform/>
              <RotateTransform/>
              <TranslateTransform/>
            </TransformGroup>
          </TextBlock.RenderTransform>
          <TextBlock.Effect>
            <DropShadowEffect Color="{DynamicResource Primary_1}" BlurRadius="128" Direction="90" ShadowDepth="0" Opacity="0.5"/>
          </TextBlock.Effect>
        </TextBlock>
      </StackPanel>
    </Grid>
  </Grid>
</Page>