<UserControl x:Class="TheBoxSoftware.DeveloperSuite.LiveDocumenter.Controls.SearchBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <DataTemplate x:Key="searchResultDataTemplate">
            <Grid Margin="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Image Grid.Column="0" Grid.Row="0" />
                <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=Name}" />
                <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Path=Summary}" Foreground="#888888" />
            </Grid>
        </DataTemplate>

        <Style x:Key="SearchResultsStyle">
            <Setter Property="Control.MinWidth" Value="400" />
            <Setter Property="Control.BorderThickness" Value="1" />
            <Setter Property="Control.BorderBrush" Value="#cccccc" />
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <TextBox x:Name="searchBox" TextChanged="Search_TextChanged" 
                                 Padding="3" 
                                 BorderThickness="0,0,0,1"
                                 BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" />
        <Popup x:Name="searchResultsPopup" PlacementTarget="{Binding ElementName=searchBox}" VerticalOffset="-1" HorizontalOffset="3" PopupAnimation="Fade" MaxHeight="300" Placement="Bottom">
            <ListBox x:Name="searchResults" Style="{StaticResource SearchResultsStyle}" ItemTemplate="{DynamicResource searchResultDataTemplate}" SelectionChanged="searchResults_SelectionChanged" />
        </Popup>
    </StackPanel>
</UserControl>
