<Application
    x:Class="PowerRenameUI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
    xmlns:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                <!--  Other merged dictionaries here  -->
            </ResourceDictionary.MergedDictionaries>
            <!--  Other app resources here  -->
            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Default">
                    <StaticResource x:Key="AccentSplitButtonBackground" ResourceKey="AccentFillColorDefaultBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundDisabled" ResourceKey="AccentFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundChecked" ResourceKey="AccentFillColorDefaultBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonForeground" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundDisabled" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundChecked" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedDisabled" ResourceKey="AccentTextFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondary" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondaryPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrush" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPointerOver" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPressed" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDisabled" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDivider" ResourceKey="ControlStrokeColorOnAccentTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushChecked" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPointerOver" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPressed" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDisabled" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDivider" ResourceKey="ControlStrokeColorOnAccentTertiaryBrush" />
                    <Thickness x:Key="AccentSplitButtonBorderThemeThickness">1</Thickness>
                    <StaticResource x:Key="AccentSplitButtonInAppBarUnfocusedPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
                </ResourceDictionary>
                <ResourceDictionary x:Key="Light">
                    <StaticResource x:Key="AccentSplitButtonBackground" ResourceKey="AccentFillColorDefaultBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPressed" ResourceKey="AccentFillColorTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundDisabled" ResourceKey="AccentFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundChecked" ResourceKey="AccentFillColorDefaultBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonForeground" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundDisabled" ResourceKey="TextOnAccentFillColorDisabled" />
                    <StaticResource x:Key="AccentSplitButtonForegroundChecked" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedDisabled" ResourceKey="AccentTextFillColorDisabledBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondary" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondaryPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrush" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPointerOver" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPressed" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDisabled" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDivider" ResourceKey="ControlStrokeColorOnAccentTertiaryBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushChecked" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPointerOver" ResourceKey="AccentControlElevationBorderBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPressed" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDisabled" ResourceKey="ControlFillColorTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDivider" ResourceKey="ControlStrokeColorOnAccentTertiaryBrush" />
                    <Thickness x:Key="AccentSplitButtonBorderThemeThickness">1</Thickness>
                    <StaticResource x:Key="AccentSplitButtonInAppBarUnfocusedPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
                </ResourceDictionary>
                <ResourceDictionary x:Key="HighContrast">
                    <StaticResource x:Key="AccentSplitButtonBackground" ResourceKey="SystemColorButtonFaceColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPointerOver" ResourceKey="SystemColorHighlightTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundPressed" ResourceKey="SystemColorHighlightTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundDisabled" ResourceKey="SystemColorWindowColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundChecked" ResourceKey="SystemColorHighlightColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPointerOver" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedPressed" ResourceKey="SystemColorButtonFaceColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBackgroundCheckedDisabled" ResourceKey="SystemColorGrayTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForeground" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundPressed" ResourceKey="SystemColorHighlightColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundDisabled" ResourceKey="SystemColorGrayTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundChecked" ResourceKey="SystemColorHighlightTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPointerOver" ResourceKey="SystemColorButtonFaceColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedPressed" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundCheckedDisabled" ResourceKey="SystemColorWindowColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondary" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonForegroundSecondaryPressed" ResourceKey="SystemColorHighlightColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrush" ResourceKey="SystemControlForegroundTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushPressed" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDisabled" ResourceKey="SystemControlDisabledTransparentBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushDivider" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushChecked" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPointerOver" ResourceKey="SystemColorButtonTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedPressed" ResourceKey="SystemColorButtonFaceColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDisabled" ResourceKey="SystemColorGrayTextColorBrush" />
                    <StaticResource x:Key="AccentSplitButtonBorderBrushCheckedDivider" ResourceKey="SystemColorHighlightTextColorBrush" />
                    <Thickness x:Key="AccentSplitButtonBorderThemeThickness">1</Thickness>
                    <StaticResource x:Key="AccentSplitButtonInAppBarUnfocusedPointerOver" ResourceKey="SystemColorButtonFaceColorBrush" />
                </ResourceDictionary>
            </ResourceDictionary.ThemeDictionaries>

            <Style x:Key="AccentSplitButtonStyle" TargetType="controls:SplitButton">
                <Setter Property="Background" Value="{ThemeResource AccentSplitButtonBackground}" />
                <Setter Property="Foreground" Value="{ThemeResource AccentSplitButtonForeground}" />
                <Setter Property="BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrush}" />
                <Setter Property="BorderThickness" Value="{ThemeResource SplitButtonBorderThemeThickness}" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                <Setter Property="FontWeight" Value="Normal" />
                <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                <Setter Property="UseSystemFocusVisuals" Value="True" />
                <Setter Property="FocusVisualMargin" Value="-1" />
                <Setter Property="IsTabStop" Value="True" />
                <Setter Property="Padding" Value="{ThemeResource ButtonPadding}" />
                <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="controls:SplitButton">
                            <Grid
                                x:Name="RootGrid"
                                Background="Transparent"
                                CornerRadius="{TemplateBinding CornerRadius}">
                                <Grid.Resources>
                                    <!--  Override the style of the inner buttons so that they don't affect background/foreground/border colors  -->
                                    <Style TargetType="Button">
                                        <Setter Property="Foreground" Value="{ThemeResource AccentSplitButtonForeground}" />
                                        <Setter Property="BorderBrush" Value="Transparent" />
                                        <Setter Property="BorderThickness" Value="{ThemeResource SplitButtonBorderThemeThickness}" />
                                        <Setter Property="HorizontalAlignment" Value="Left" />
                                        <Setter Property="VerticalAlignment" Value="Center" />
                                        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                                        <Setter Property="FontWeight" Value="Normal" />
                                        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                                        <Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
                                        <Setter Property="FocusVisualMargin" Value="-3" />
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="Button">
                                                    <Grid x:Name="RootGrid" Background="Transparent">
                                                        <ContentPresenter
                                                            xmlns:local="using:Microsoft.UI.Xaml.Controls"
                                                            x:Name="ContentPresenter"
                                                            Padding="{TemplateBinding Padding}"
                                                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                            local:AnimatedIcon.State="Normal"
                                                            AutomationProperties.AccessibilityView="Raw"
                                                            BorderBrush="{TemplateBinding BorderBrush}"
                                                            BorderThickness="{TemplateBinding BorderThickness}"
                                                            Content="{TemplateBinding Content}"
                                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                                            ContentTransitions="{TemplateBinding ContentTransitions}"
                                                            Foreground="{TemplateBinding Foreground}"
                                                            Opacity="1" />
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup x:Name="CommonStates">
                                                                <VisualState x:Name="Normal" />
                                                                <VisualState x:Name="PointerOver">
                                                                    <VisualState.Setters>
                                                                        <Setter Target="ContentPresenter.(controls:AnimatedIcon.State)" Value="PointerOver" />
                                                                    </VisualState.Setters>
                                                                </VisualState>
                                                                <VisualState x:Name="Pressed">
                                                                    <VisualState.Setters>
                                                                        <Setter Target="ContentPresenter.(controls:AnimatedIcon.State)" Value="Pressed" />
                                                                    </VisualState.Setters>
                                                                </VisualState>
                                                                <VisualState x:Name="Disabled">
                                                                    <VisualState.Setters>
                                                                        <Setter Target="ContentPresenter.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedDisabled}" />
                                                                    </VisualState.Setters>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Grid.Resources>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition
                                        x:Name="PrimaryButtonColumn"
                                        Width="*"
                                        MinWidth="{ThemeResource SplitButtonPrimaryButtonSize}" />
                                    <ColumnDefinition x:Name="Separator" Width="1" />
                                    <ColumnDefinition x:Name="SecondaryButtonColumn" Width="{ThemeResource SplitButtonSecondaryButtonSize}" />
                                </Grid.ColumnDefinitions>
                                <Grid
                                    x:Name="PrimaryBackgroundGrid"
                                    Grid.ColumnSpan="2"
                                    Background="{TemplateBinding Background}" />
                                <Grid
                                    x:Name="DividerBackgroundGrid"
                                    Grid.Column="1"
                                    Width="1"
                                    Background="{ThemeResource AccentSplitButtonBorderBrushDivider}" />
                                <Grid
                                    x:Name="SecondaryBackgroundGrid"
                                    Grid.Column="2"
                                    Background="{TemplateBinding Background}" />
                                <Button
                                    x:Name="PrimaryButton"
                                    Grid.Column="0"
                                    Padding="{TemplateBinding Padding}"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    AutomationProperties.AccessibilityView="Raw"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="Transparent"
                                    BorderThickness="0"
                                    Command="{TemplateBinding Command}"
                                    CommandParameter="{TemplateBinding CommandParameter}"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTransitions="{TemplateBinding ContentTransitions}"
                                    FontFamily="{TemplateBinding FontFamily}"
                                    FontSize="{TemplateBinding FontSize}"
                                    FontWeight="{TemplateBinding FontWeight}"
                                    Foreground="{TemplateBinding Foreground}"
                                    IsTabStop="False" />
                                <Button
                                    x:Name="SecondaryButton"
                                    Grid.Column="2"
                                    Padding="0,0,12,0"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    HorizontalContentAlignment="Stretch"
                                    VerticalContentAlignment="Stretch"
                                    AutomationProperties.AccessibilityView="Raw"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="Transparent"
                                    BorderThickness="0"
                                    Foreground="{ThemeResource AccentSplitButtonForegroundSecondary}"
                                    IsTabStop="False">
                                    <Button.Content>
                                        <controls:AnimatedIcon
                                            Width="12"
                                            Height="12"
                                            HorizontalAlignment="Right"
                                            VerticalAlignment="Center"
                                            AutomationProperties.AccessibilityView="Raw">
                                            <animatedVisuals:AnimatedChevronDownSmallVisualSource />
                                            <controls:AnimatedIcon.FallbackIconSource>
                                                <controls:FontIconSource
                                                    FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                                    FontSize="8"
                                                    Glyph="&#xE96E;"
                                                    IsTextScaleFactorEnabled="False" />
                                            </controls:AnimatedIcon.FallbackIconSource>
                                        </controls:AnimatedIcon>
                                    </Button.Content>
                                </Button>
                                <Grid
                                    x:Name="Border"
                                    Grid.ColumnSpan="3"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}" />
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="Disabled">
                                            <VisualState.Setters>
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushDisabled}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundDisabled}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundDisabled}" />

                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="FlyoutOpen">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundSecondaryPressed}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="TouchPressed">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundSecondaryPressed}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="PrimaryPointerOver">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPointerOver}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundPointerOver}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackground}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="PrimaryPressed">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackground}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="SecondaryPointerOver">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackground}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPointerOver}" />
                                                <Setter Target="SecondaryButton.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushPointerOver}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundPointerOver}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="SecondaryPressed">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackground}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundSecondaryPressed}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="Checked">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushChecked}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedFlyoutOpen">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedTouchPressed">
                                            <VisualState.Setters>
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedPrimaryPointerOver">
                                            <VisualState.Setters>
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushChecked}" />
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPointerOver}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPointerOver}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedPrimaryPressed">
                                            <VisualState.Setters>
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushChecked}" />
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedSecondaryPointerOver">
                                            <VisualState.Setters>
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushChecked}" />
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPointerOver}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPointerOver}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                        <VisualState x:Name="CheckedSecondaryPressed">
                                            <VisualState.Setters>
                                                <Setter Target="Border.BorderBrush" Value="{ThemeResource AccentSplitButtonBorderBrushChecked}" />
                                                <Setter Target="PrimaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundChecked}" />
                                                <Setter Target="PrimaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundChecked}" />
                                                <Setter Target="SecondaryBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBackgroundCheckedPressed}" />
                                                <Setter Target="SecondaryButton.Foreground" Value="{ThemeResource AccentSplitButtonForegroundCheckedPressed}" />
                                                <Setter Target="DividerBackgroundGrid.Background" Value="{ThemeResource AccentSplitButtonBorderBrushCheckedDivider}" />
                                            </VisualState.Setters>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="SecondaryButtonPlacementStates">
                                        <VisualState x:Name="SecondaryButtonRight" />
                                        <VisualState x:Name="SecondaryButtonSpan">
                                            <VisualState.Setters>
                                                <Setter Target="SecondaryButton.(Grid.Column)" Value="0" />
                                                <Setter Target="SecondaryButton.(Grid.ColumnSpan)" Value="3" />
                                            </VisualState.Setters>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <x:Double x:Key="AutoSuggestListMaxHeight">286</x:Double>
            <!--  This will make sure the AutoSuggestBox flyout does not overlap with the Apply button  -->

            <Style x:Key="AutoSuggestBoxTextBoxStyle" TargetType="TextBox">
                <Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
                <Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
                <Setter Property="Foreground" Value="{ThemeResource TextControlForeground}" />
                <Setter Property="Background" Value="{ThemeResource TextControlBackground}" />
                <Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}" />
                <Setter Property="SelectionHighlightColor" Value="{ThemeResource TextControlSelectionHighlightColor}" />
                <Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
                <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto" />
                <Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto" />
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
                <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
                <Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TextBox">
                            <Grid>
                                <Grid.Resources>
                                    <Style x:Name="DeleteButtonStyle" TargetType="Button">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="Button">
                                                    <Grid
                                                        x:Name="ButtonLayoutGrid"
                                                        Margin="{StaticResource AutoSuggestBoxDeleteButtonMargin}"
                                                        Background="{ThemeResource TextControlButtonBackground}"
                                                        BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
                                                        BorderThickness="{TemplateBinding BorderThickness}"
                                                        CornerRadius="{ThemeResource ControlCornerRadius}">
                                                        <TextBlock
                                                            x:Name="GlyphElement"
                                                            HorizontalAlignment="Center"
                                                            VerticalAlignment="Center"
                                                            AutomationProperties.AccessibilityView="Raw"
                                                            FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                                            FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
                                                            FontStyle="Normal"
                                                            Foreground="{ThemeResource TextControlButtonForeground}"
                                                            Text="&#xe894;" />
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup x:Name="CommonStates">
                                                                <VisualState x:Name="Normal" />

                                                                <VisualState x:Name="PointerOver">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBackgroundPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>

                                                                <VisualState x:Name="Pressed">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBackgroundPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>

                                                                <VisualState x:Name="Disabled">
                                                                    <Storyboard>
                                                                        <DoubleAnimation
                                                                            Storyboard.TargetName="ButtonLayoutGrid"
                                                                            Storyboard.TargetProperty="Opacity"
                                                                            To="0"
                                                                            Duration="0" />
                                                                    </Storyboard>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                    <Style x:Name="QueryButtonStyle" TargetType="Button">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="Button">
                                                    <ContentPresenter
                                                        x:Name="ContentPresenter"
                                                        Margin="{ThemeResource AutoSuggestBoxInnerButtonMargin}"
                                                        Padding="{TemplateBinding Padding}"
                                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        AnimatedIcon.State="Normal"
                                                        AutomationProperties.AccessibilityView="Raw"
                                                        Background="{ThemeResource TextControlButtonBackground}"
                                                        BackgroundSizing="{TemplateBinding BackgroundSizing}"
                                                        BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
                                                        BorderThickness="{TemplateBinding BorderThickness}"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        ContentTransitions="{TemplateBinding ContentTransitions}"
                                                        CornerRadius="{TemplateBinding CornerRadius}"
                                                        FontSize="{ThemeResource AutoSuggestBoxIconFontSize}">
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup x:Name="CommonStates">
                                                                <VisualState x:Name="Normal" />

                                                                <VisualState x:Name="PointerOver">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBackgroundPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPointerOver}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                    <VisualState.Setters>
                                                                        <Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="PointerOver" />
                                                                    </VisualState.Setters>
                                                                </VisualState>

                                                                <VisualState x:Name="Pressed">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBackgroundPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                    <VisualState.Setters>
                                                                        <Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="Pressed" />
                                                                    </VisualState.Setters>
                                                                </VisualState>

                                                                <VisualState x:Name="Disabled">
                                                                    <Storyboard>
                                                                        <DoubleAnimation
                                                                            Storyboard.TargetName="ContentPresenter"
                                                                            Storyboard.TargetProperty="Opacity"
                                                                            To="0"
                                                                            Duration="0" />
                                                                    </Storyboard>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                    </ContentPresenter>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Grid.Resources>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="{ThemeResource AutoSuggestBoxRightButtonMargin}" />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Border
                                    x:Name="BorderElement"
                                    Grid.Row="1"
                                    Grid.RowSpan="1"
                                    Grid.ColumnSpan="4"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}" />
                                <ContentPresenter
                                    x:Name="HeaderContentPresenter"
                                    Grid.Row="0"
                                    Grid.ColumnSpan="4"
                                    Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
                                    x:DeferLoadStrategy="Lazy"
                                    Content="{TemplateBinding Header}"
                                    ContentTemplate="{TemplateBinding HeaderTemplate}"
                                    FontWeight="Normal"
                                    Foreground="{ThemeResource TextControlHeaderForeground}"
                                    TextWrapping="Wrap"
                                    Visibility="Collapsed" />
                                <ScrollViewer
                                    x:Name="ContentElement"
                                    Grid.Row="1"
                                    Margin="{TemplateBinding BorderThickness}"
                                    Padding="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    AutomationProperties.AccessibilityView="Raw"
                                    HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                    HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                    IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                    IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                    IsTabStop="False"
                                    IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                    VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                    VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                    ZoomMode="Disabled" />
                                <ContentControl
                                    x:Name="PlaceholderTextContentPresenter"
                                    Grid.Row="1"
                                    Grid.ColumnSpan="2"
                                    Margin="{TemplateBinding BorderThickness}"
                                    Padding="{TemplateBinding Padding}"
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Content="{TemplateBinding PlaceholderText}"
                                    Foreground="{ThemeResource TextControlPlaceholderForeground}"
                                    IsHitTestVisible="False"
                                    IsTabStop="False" />
                                <Button
                                    x:Name="DeleteButton"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Width="32"
                                    Padding="{ThemeResource HelperButtonThemePadding}"
                                    VerticalAlignment="Stretch"
                                    AutomationProperties.AccessibilityView="Raw"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    FontSize="{TemplateBinding FontSize}"
                                    IsTabStop="False"
                                    Style="{StaticResource DeleteButtonStyle}"
                                    Visibility="Collapsed" />
                                <Button
                                    x:Name="QueryButton"
                                    Grid.Row="1"
                                    Grid.Column="2"
                                    Width="32"
                                    Height="28"
                                    Margin="2,0,0,0"
                                    Padding="{ThemeResource HelperButtonThemePadding}"
                                    VerticalAlignment="Stretch"
                                    AutomationProperties.AccessibilityView="Raw"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    FontSize="{TemplateBinding FontSize}"
                                    IsTabStop="False"
                                    Style="{StaticResource QueryButtonStyle}" />
                                <ContentPresenter
                                    x:Name="DescriptionPresenter"
                                    Grid.Row="2"
                                    Grid.ColumnSpan="4"
                                    x:Load="False"
                                    AutomationProperties.AccessibilityView="Raw"
                                    Content="{TemplateBinding Description}"
                                    Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}" />

                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">

                                        <VisualState x:Name="Disabled">

                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Normal" />

                                        <VisualState x:Name="PointerOver">

                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Focused">

                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundFocused}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderThickness">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>

                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="ButtonStates">
                                        <VisualState x:Name="ButtonVisible">

                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Visible</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="ButtonCollapsed" />

                                    </VisualStateGroup>

                                </VisualStateManager.VisualStateGroups>
                            </Grid>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style BasedOn="{StaticResource DefaultAutoSuggestBoxStyle}" TargetType="AutoSuggestBox" />

            <Style x:Key="DefaultAutoSuggestBoxStyle" TargetType="AutoSuggestBox">
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Stretch" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="IsTabStop" Value="False" />
                <Setter Property="Foreground" Value="{ThemeResource TextControlForeground}" />
                <Setter Property="Background" Value="{ThemeResource TextControlBackground}" />
                <Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}" />
                <Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
                <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                <Setter Property="TextBoxStyle" Value="{StaticResource AutoSuggestBoxTextBoxStyle}" />
                <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
                <Setter Property="primitives:AutoSuggestBoxHelper.KeepInteriorCornersSquare" Value="true" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="AutoSuggestBox">
                            <Grid x:Name="LayoutRoot">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>

                                <TextBox
                                    x:Name="TextBox"
                                    Width="{TemplateBinding Width}"
                                    Margin="0"
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Canvas.ZIndex="0"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    Description="{TemplateBinding Description}"
                                    DesiredCandidateWindowAlignment="BottomEdge"
                                    FontFamily="{TemplateBinding FontFamily}"
                                    FontSize="{TemplateBinding FontSize}"
                                    FontStretch="{TemplateBinding FontStretch}"
                                    FontWeight="{TemplateBinding FontWeight}"
                                    Foreground="{TemplateBinding Foreground}"
                                    Header="{TemplateBinding Header}"
                                    IsSpellCheckEnabled="False"
                                    PlaceholderText="{TemplateBinding PlaceholderText}"
                                    ScrollViewer.BringIntoViewOnFocusChange="False"
                                    Style="{TemplateBinding TextBoxStyle}"
                                    UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}" />

                                <Popup x:Name="SuggestionsPopup">
                                    <Border
                                        x:Name="SuggestionsContainer"
                                        Padding="{ThemeResource AutoSuggestListMargin}"
                                        Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"
                                        BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}"
                                        BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}"
                                        CornerRadius="{ThemeResource OverlayCornerRadius}">
                                        <ListView
                                            x:Name="SuggestionsList"
                                            MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
                                            Margin="{ThemeResource AutoSuggestListPadding}"
                                            DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                                            IsItemClickEnabled="True"
                                            ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                                            ItemTemplate="{TemplateBinding ItemTemplate}"
                                            ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}" />
                                    </Border>
                                </Popup>

                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="Orientation">
                                        <VisualState x:Name="Landscape" />
                                        <VisualState x:Name="Portrait" />
                                    </VisualStateGroup>

                                </VisualStateManager.VisualStateGroups>
                            </Grid>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <!--  Copied from https://github.com/microsoft/microsoft-ui-xaml/blob/210349d9d1e0aeb8ee144ec027071a68ac578bdb/dev/CommonStyles/CheckBox_themeresources.xaml#L794 to remove the AnimatedIcon that caused crashes (see #18478).  -->
            <Style x:Key="CheckBoxDefaultStyleOverride" TargetType="CheckBox">
                <Setter Property="Background" Value="{ThemeResource CheckBoxBackgroundUnchecked}" />
                <Setter Property="Foreground" Value="{ThemeResource CheckBoxForegroundUnchecked}" />
                <Setter Property="BorderBrush" Value="{ThemeResource CheckBoxBorderBrushUnchecked}" />
                <Setter Property="Padding" Value="{StaticResource CheckBoxPadding}" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="HorizontalContentAlignment" Value="Left" />
                <Setter Property="VerticalContentAlignment" Value="Top" />
                <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                <Setter Property="MinWidth" Value="{StaticResource CheckBoxMinWidth}" />
                <Setter Property="MinHeight" Value="{StaticResource CheckBoxHeight}" />
                <Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
                <Setter Property="FocusVisualMargin" Value="{StaticResource CheckBoxFocusVisualMargin}" />
                <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
