<UserControl x:Class="GitHub.VisualStudio.Views.Dialog.Clone.SelectPageView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ghfvs="https://github.com/github/VisualStudio"
             mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="400">
    <d:DesignData.DataContext>
        <ghfvs:SelectPageViewModelDesigner/>
    </d:DesignData.DataContext>

    <Control.Resources>
        <ResourceDictionary Source="../DialogStyles.xaml" />
    </Control.Resources>

    <DockPanel>
        <ghfvs:PromptTextBox Name="SearchTextBox"
                             DockPanel.Dock="Top"
                             Margin="0,9"
                             PromptText="{x:Static ghfvs:Resources.OpenFromGitHubSearchOrEnterAUrl}"
                             Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged, Delay=300}"
                             KeyboardNavigation.TabIndex="1" />

        <Grid>
            <ListView BorderThickness="0"
                      ItemsSource="{Binding ItemsView}"
                      SelectedItem="{Binding SelectedItem}"
                      VirtualizingPanel.IsVirtualizing="True"
                      VirtualizingPanel.IsVirtualizingWhenGrouping="True"
                      KeyboardNavigation.TabIndex="2">
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock FontWeight="Bold"
                                           Margin="0 4"
                                           Text="{Binding Name}"/>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                    </GroupStyle>
                </ListView.GroupStyle>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <ghfvs:OcticonImage Icon="{Binding Icon}"/>
                            <TextBlock Margin="4" Text="{Binding Caption}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <ghfvs:Spinner Visibility="{Binding IsLoading, Converter={ghfvs:BooleanToVisibilityConverter}}"
                           Width="32"
                           Height="32"/>
            <TextBlock Text="{Binding Error.Message}"
                       Margin="4"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       TextAlignment="Center"
                       TextWrapping="Wrap"/>
        </Grid>
    </DockPanel>
</UserControl>
