<UserControl x:Class="Microsoft.Terminal.Control.SearchBoxControl"
             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:local="using:Microsoft.Terminal.Control"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             x:Name="Root"
             HorizontalAlignment="Stretch"
             VerticalAlignment="Top"
             d:DesignHeight="55"
             d:DesignWidth="285"
             TabNavigation="Cycle"
             mc:Ignorable="d">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Dark">
                    <Style x:Key="FontIconStyle"
                           TargetType="FontIcon">
                        <Setter Property="FontSize" Value="12" />
                    </Style>

                    <!--  ToggleButton colors !  -->
                    <StaticResource x:Key="ToggleButtonBackground"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundPointerOver"
                                    ResourceKey="SubtleFillColorSecondaryBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundPressed"
                                    ResourceKey="SubtleFillColorTertiaryBrush" />

                    <StaticResource x:Key="ToggleButtonBorderBrush"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushPointerOver"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushPressed"
                                    ResourceKey="SubtleFillColorTransparentBrush" />

                    <StaticResource x:Key="ToggleButtonForegroundChecked"
                                    ResourceKey="TextFillColorPrimaryBrush" />
                    <StaticResource x:Key="ToggleButtonForegroundCheckedPointerOver"
                                    ResourceKey="TextFillColorPrimaryBrush" />
                    <StaticResource x:Key="ToggleButtonForegroundCheckedPressed"
                                    ResourceKey="TextFillColorSecondaryBrush" />

                    <StaticResource x:Key="ToggleButtonBackgroundChecked"
                                    ResourceKey="ControlFillColorDefaultBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver"
                                    ResourceKey="ControlFillColorSecondaryBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundCheckedPressed"
                                    ResourceKey="ControlFillColorTertiaryBrush" />

                    <StaticResource x:Key="ToggleButtonBorderBrushChecked"
                                    ResourceKey="ControlElevationBorderBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushCheckedPointerOver"
                                    ResourceKey="ControlElevationBorderBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushCheckedPressed"
                                    ResourceKey="ControlStrokeColorDefaultBrush" />

                    <BackgroundSizing x:Key="ToggleButtonCheckedStateBackgroundSizing">InnerBorderEdge</BackgroundSizing>

                    <!--  Button color !  -->
                    <StaticResource x:Key="ButtonBackground"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBackgroundPointerOver"
                                    ResourceKey="SubtleFillColorSecondaryBrush" />
                    <StaticResource x:Key="ButtonBackgroundPressed"
                                    ResourceKey="SubtleFillColorTertiaryBrush" />

                    <StaticResource x:Key="ButtonBorderBrush"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBorderBrushPointerOver"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBorderBrushPressed"
                                    ResourceKey="SubtleFillColorTransparentBrush" />

                </ResourceDictionary>
                <ResourceDictionary x:Key="Light">
                    <Style x:Key="FontIconStyle"
                           TargetType="FontIcon">
                        <Setter Property="FontSize" Value="12" />
                    </Style>

                    <!--  ToggleButton colors !  -->
                    <StaticResource x:Key="ToggleButtonBackground"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundPointerOver"
                                    ResourceKey="SubtleFillColorSecondaryBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundPressed"
                                    ResourceKey="SubtleFillColorTertiaryBrush" />

                    <StaticResource x:Key="ToggleButtonBorderBrush"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushPointerOver"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushPressed"
                                    ResourceKey="SubtleFillColorTransparentBrush" />

                    <StaticResource x:Key="ToggleButtonForegroundChecked"
                                    ResourceKey="TextFillColorPrimaryBrush" />
                    <StaticResource x:Key="ToggleButtonForegroundCheckedPointerOver"
                                    ResourceKey="TextFillColorPrimaryBrush" />
                    <StaticResource x:Key="ToggleButtonForegroundCheckedPressed"
                                    ResourceKey="TextFillColorSecondaryBrush" />

                    <StaticResource x:Key="ToggleButtonBackgroundChecked"
                                    ResourceKey="ControlFillColorDefaultBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver"
                                    ResourceKey="ControlFillColorSecondaryBrush" />
                    <StaticResource x:Key="ToggleButtonBackgroundCheckedPressed"
                                    ResourceKey="ControlFillColorTertiaryBrush" />

                    <StaticResource x:Key="ToggleButtonBorderBrushChecked"
                                    ResourceKey="ControlElevationBorderBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushCheckedPointerOver"
                                    ResourceKey="ControlElevationBorderBrush" />
                    <StaticResource x:Key="ToggleButtonBorderBrushCheckedPressed"
                                    ResourceKey="ControlStrokeColorDefaultBrush" />

                    <BackgroundSizing x:Key="ToggleButtonCheckedStateBackgroundSizing">InnerBorderEdge</BackgroundSizing>

                    <!--  Button color !  -->
                    <StaticResource x:Key="ButtonBackground"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBackgroundPointerOver"
                                    ResourceKey="SubtleFillColorSecondaryBrush" />
                    <StaticResource x:Key="ButtonBackgroundPressed"
                                    ResourceKey="SubtleFillColorTertiaryBrush" />

                    <StaticResource x:Key="ButtonBorderBrush"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBorderBrushPointerOver"
                                    ResourceKey="SubtleFillColorTransparentBrush" />
                    <StaticResource x:Key="ButtonBorderBrushPressed"
                                    ResourceKey="SubtleFillColorTransparentBrush" />

                </ResourceDictionary>
                <ResourceDictionary x:Key="HighContrast">
                    <Style x:Key="FontIconStyle"
                           TargetType="FontIcon">
                        <Setter Property="FontSize" Value="12" />
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.ThemeDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Margin="8"
                Padding="4,8"
                Background="{ThemeResource FlyoutPresenterBackground}"
                BorderBrush="{ThemeResource FlyoutBorderThemeBrush}"
                BorderThickness="{ThemeResource FlyoutBorderThemeThickness}"
                CornerRadius="{ThemeResource OverlayCornerRadius}"
                Orientation="Horizontal"
                Shadow="{StaticResource SharedShadow}"
                Translation="0,0,16">
        <TextBox x:Name="TextBox"
                 x:Uid="SearchBox_TextBox"
                 Width="160"
                 Margin="4,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Center"
                 IsSpellCheckEnabled="False"
                 KeyDown="TextBoxKeyDown" />

        <ToggleButton x:Name="GoBackwardButton"
                      x:Uid="SearchBox_SearchBackwards"
                      Width="32"
                      Height="32"
                      Margin="4,0"
                      Padding="0"
                      BackgroundSizing="OuterBorderEdge"
                      Click="GoBackwardClicked"
                      IsChecked="True">
            <FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
                      Glyph="&#xE74A;"
                      Style="{ThemeResource FontIconStyle}" />
        </ToggleButton>
        <ToggleButton x:Name="GoForwardButton"
                      x:Uid="SearchBox_SearchForwards"
                      Width="32"
                      Height="32"
                      Margin="4,0"
                      Padding="0"
                      BackgroundSizing="OuterBorderEdge"
                      Click="GoForwardClicked">
            <FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
                      Glyph="&#xE74B;"
                      Style="{ThemeResource FontIconStyle}" />
        </ToggleButton>

        <ToggleButton x:Name="CaseSensitivityButton"
                      x:Uid="SearchBox_CaseSensitivity"
                      Width="32"
                      Height="32"
                      Margin="4,0"
                      Padding="0"
                      BackgroundSizing="OuterBorderEdge">
            <PathIcon Data="M8.87305 10H7.60156L6.5625 7.25195H2.40625L1.42871 10H0.150391L3.91016 0.197266H5.09961L8.87305 10ZM6.18652 6.21973L4.64844 2.04297C4.59831 1.90625 4.54818 1.6875 4.49805 1.38672H4.4707C4.42513 1.66471 4.37272 1.88346 4.31348 2.04297L2.78906 6.21973H6.18652ZM15.1826 10H14.0615V8.90625H14.0342C13.5465 9.74479 12.8288 10.1641 11.8809 10.1641C11.1836 10.1641 10.6367 9.97949 10.2402 9.61035C9.84831 9.24121 9.65234 8.7513 9.65234 8.14062C9.65234 6.83268 10.4225 6.07161 11.9629 5.85742L14.0615 5.56348C14.0615 4.37402 13.5807 3.7793 12.6191 3.7793C11.776 3.7793 11.015 4.06641 10.3359 4.64062V3.49219C11.0241 3.05469 11.8171 2.83594 12.7148 2.83594C14.36 2.83594 15.1826 3.70638 15.1826 5.44727V10ZM14.0615 6.45898L12.373 6.69141C11.8535 6.76432 11.4616 6.89421 11.1973 7.08105C10.9329 7.26335 10.8008 7.58919 10.8008 8.05859C10.8008 8.40039 10.9215 8.68066 11.1631 8.89941C11.4092 9.11361 11.735 9.2207 12.1406 9.2207C12.6966 9.2207 13.1546 9.02702 13.5146 8.63965C13.8792 8.24772 14.0615 7.75326 14.0615 7.15625V6.45898Z" />
        </ToggleButton>

        <Button x:Name="CloseButton"
                x:Uid="SearchBox_Close"
                Width="32"
                Height="32"
                Margin="4,0"
                Padding="0"
                BackgroundSizing="OuterBorderEdge"
                Click="CloseClick">
            <FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
                      FontSize="12"
                      Glyph="&#xE711;" />
        </Button>
    </StackPanel>
</UserControl>
