<UserControl
    x:Class="mpvnet.SearchTextBoxUserControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    mc:Ignorable="d" 
    d:DesignHeight="450"
    d:DesignWidth="800"
    >
    
    <Grid
        Name="SearchTextBoxUserControl1"
        Background="{Binding Theme.Background}"
        >
        
        <TextBlock
            Name="HintTextBlock"
            Padding="6,1"
            Text="Find a setting"
            VerticalAlignment="Center"
            Foreground="{Binding Theme.Foreground2}"
            Background="{Binding Theme.Background}"
            />
        
        <TextBox
            Name="SearchTextBox"
            Height="25"
            BorderThickness="2"
            Padding="2"
            Background="Transparent"
            TextChanged="SearchTextBox_TextChanged"
            Foreground="{Binding Theme.Foreground}"
            CaretBrush="{Binding Theme.Foreground}"
            />
        
        <Button
            Name="SearchClearButton"
            Background="Transparent"
            HorizontalAlignment="Right"
            FontFamily="Marlett"
            FontSize="10"
            Width="17"
            Height="17"
            Margin="2,0,4,0"
            Visibility="Hidden"
            Click="SearchClearButton_Click"
            >r

            <Button.Resources>
                <Style TargetType="{x:Type Border}">
                    <Setter Property="CornerRadius" Value="3"/>
                </Style>
            </Button.Resources>
            
            <Button.Style>
                <Style TargetType="Button">
                    <Setter Property="Background" Value="{Binding Theme.Background}"/>
                    <Setter Property="Foreground" Value="{Binding Theme.Foreground2}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Button">
                                <Border
                                    BorderThickness="1"
                                    BorderBrush="{TemplateBinding Foreground}"
                                    SnapsToDevicePixels="True"
                                    >
                                    
                                    <ContentPresenter
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="{Binding Theme.Heading}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>
    </Grid>
</UserControl>