<UserControl
    DataContext="{Binding (HUDData.Data), RelativeSource={RelativeSource Self}}" 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:System="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:ForzaUI"
    mc:Ignorable="d"
    x:Class="ForzaUI.HUDTestDriveTimeLeftControl"
    Margin="0,0,0,0"
    VerticalAlignment="Top"
    HorizontalAlignment="Center">

    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="A_Style_FZTextBlock_TestDrive" TargetType="{x:Type local:FZTextBlock}">
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="TextAlignment" Value="Center"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="TextWrapping" Value="NoWrap"/>
                <Setter Property="CapHeight" Value="16" />
                <Setter Property="FontFamily" Value="Horizon_C" />
                <Setter Property="Margin" Value="7,0,0,0" />
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}" />
              <!--<Setter Property="local:ScreenReader.LineType" Value="NetworkStatusText"/>
                <Setter Property="local:ScreenReader.Event" Value="OnChange"/>
                <Setter Property="local:ScreenReader.Line" Value="{Binding TextScreenReader, Converter={StaticResource A_Converter_TrimInlineMarkup}}"/>
                <Setter Property="local:ScreenReader.InterruptBehavior" Value="CancelAllExceptPlaying"/>-->
            </Style>

            <Style x:Key="A_Style_FZTextBlock_TestDriveSubtext" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_TestDrive}">
              <Setter Property="FontFamily" Value="Horizon_B" />
              <Setter Property="Effect" Value="{StaticResource A_DropShadowEffect_DefaultHud}" />

              <!--<Setter Property="local:ScreenReader.LineType" Value="NetworkStatusSubtext"/>
                <Setter Property="local:ScreenReader.Line" Value="{Binding SubtextScreenReader, Converter={StaticResource A_Converter_TrimInlineMarkup}}"/>-->
            </Style>
            
            <Style x:Key="A_Style_FZRun_TestDriveMarkup_HIGHLIGHT" TargetType="{x:Type local:FZRun}">
                <Setter Property="Color" Value="{StaticResource A_Color_HUD_Text}"/>
            </Style>

        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="PART_LayoutRoot">
        <Grid.Resources>
            <QuadraticEase x:Key="A_EasingFunction_EaseIn" EasingMode="EaseIn"/>
            <QuadraticEase x:Key="A_EasingFunction_EaseOut" EasingMode="EaseOut"/>
            <System:Double x:Key="A_Double_Control_Width">300</System:Double>

            <Storyboard x:Key="A_Storyboard_Hidden">
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_LayoutRoot">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Collapsed}"/>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>

          <Storyboard x:Key="A_Storyboard_Shown">
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_LayoutRoot">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Visible}"/>
                </ObjectAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TextBlock">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
          </Storyboard>

            <Storyboard x:Key="A_Storyboard_Hidden_To_Any">
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_LayoutRoot">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Visible}"/>
                </ObjectAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TextBlock">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="1" EasingFunction="{StaticResource A_EasingFunction_EaseOut}"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_Any_To_Hidden">
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_LayoutRoot">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{x:Static Visibility.Visible}"/>
                </ObjectAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TextBlock">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0" EasingFunction="{StaticResource A_EasingFunction_EaseIn}"/>
                </DoubleAnimationUsingKeyFrames>
                <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="EventFire">
                    <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value=""/>
                    <DiscreteStringKeyFrame KeyTime="0:0:0.25" Value="Finished"/>
                    <DiscreteStringKeyFrame KeyTime="0:0:0.27" Value=""/>
                </StringAnimationUsingKeyFrames>
            </Storyboard>

        </Grid.Resources>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="PART_Hidden" Storyboard="{StaticResource A_Storyboard_Hidden}"/>
                <VisualState x:Name="PART_Shown" Storyboard="{StaticResource A_Storyboard_Shown}"/>
                <VisualStateGroup.Transitions>
                    <VisualTransition From="PART_Hidden" GeneratedDuration="0:0:0.25" Storyboard="{StaticResource A_Storyboard_Hidden_To_Any}"/>
                    <VisualTransition To="PART_Hidden" GeneratedDuration="0:0:0.25" Storyboard="{StaticResource A_Storyboard_Any_To_Hidden}"/>
                </VisualStateGroup.Transitions>
            </VisualStateGroup>

        </VisualStateManager.VisualStateGroups>

        <Decorator x:Name="TextBlock" Opacity="0">
                  <StackPanel Orientation="Vertical">
                    <local:FZMaterial Width="{StaticResource A_Double_Control_Width}"
                                      Color="{StaticResource H_Color_Primary_Green}"
                                      Preset="{StaticResource H_Roundtangle_TopOnly_3px}"
                                      Height="34">
                      <local:FZTextBlock Text="{Binding Text}"
                                         Style="{StaticResource A_Style_FZTextBlock_TestDrive}"
                                         Color="{StaticResource H_Color_Primary_Black}"
                                         TrackingAdjust="-0.02"/>
                    </local:FZMaterial>

                    <local:FZMaterial Width="{StaticResource A_Double_Control_Width}"
                                      Height="30"
                                      Color="{StaticResource H_Color_Glass_Purple_40pc}"
                                      Preset="{StaticResource H_GlassRoundtangle_BottomOnly_3px}"
                                      HorizontalAlignment="Center">
                        <local:FZTextBlock x:Name="SubText"
                                           Text="{Binding SubText}" 
                                           Style="{StaticResource A_Style_FZTextBlock_TestDriveSubtext}" 
                                           Visibility="{Binding SubText, Converter={StaticResource A_StringVisConverter}}" 
                                           TrackingAdjust="-0.03"/>
                    </local:FZMaterial>
                  </StackPanel>
        </Decorator>
        <local:EventFire x:Name="EventFire" />
    </Grid>
</UserControl>