<UserControl x:Class="CalculatorApp.TitleBar"
             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"
             mc:Ignorable="d">
    <Grid x:Name="LayoutRoot"
          Height="32"
          HorizontalAlignment="Stretch">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="WindowFocusStates">
                <VisualState x:Name="WindowFocused"/>
                <VisualState x:Name="WindowNotFocused">
                    <VisualState.Setters>
                        <Setter Target="AppName.Foreground" Value="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="AOTStates">
                <VisualState x:Name="AOTNormalState"/>
                <VisualState x:Name="AOTMiniState">
                    <VisualState.Setters>
                        <Setter Target="AppName.Visibility" Value="Collapsed"/>
                        <Setter Target="ExitAlwaysOnTopButton.Visibility" Value="Visible"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid x:Name="BackgroundElement"
              Height="32"
              Background="Transparent">
            <TextBlock x:Name="AppName"
                       x:Uid="AppName"
                       Margin="12,0,12,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Center"
                       Foreground="{ThemeResource TitleBarForegroundBaseHighBrush}"
                       FontSize="12"
                       TextAlignment="Left"
                       TextTrimming="CharacterEllipsis"/>
        </Grid>
        <Button x:Name="ExitAlwaysOnTopButton"
                x:Uid="ExitAlwaysOnTopButton"
                Width="46"
                Height="Auto"
                HorizontalAlignment="Left"
                HorizontalContentAlignment="Center"
                Style="{ThemeResource CommandBarFlyoutEllipsisButtonStyle}"
                Background="Transparent"
                FontFamily="{StaticResource CalculatorFontFamily}"
                FontSize="14"
                FontWeight="Thin"
                x:Load="False"
                AutomationProperties.AutomationId="ExitAlwaysOnTopButton"
                Click="AlwaysOnTopButton_Click"
                Content="&#xEE47;"
                Visibility="Collapsed"/>
    </Grid>
</UserControl>
