<UserControl x:Class="ConfigFileManager.Controls.FileSelector.DirectorySelector"
             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:local="clr-namespace:ConfigFileManager.Controls.FileSelector"
             mc:Ignorable="d" 
             x:Name="This"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary Source="/UICommon;component/Resources.xaml"/>
    </UserControl.Resources>

    <Grid Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="0"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid>
            <Button Background="Transparent" BorderBrush="{StaticResource ThemeColor}" TextElement.Foreground="{StaticResource ThemeColor}"
                    Click="Button_Click_1" VerticalAlignment="Bottom" Height="24" Margin="4" Width="60" HorizontalAlignment="Left" Panel.ZIndex="1">
                返回上级
            </Button>
            <TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="14" 
                       Foreground="{StaticResource ThemeColor}" Text="{Binding ElementName=This, Path=Title}"/>
        </Grid>

        <ScrollViewer Grid.Row="2" Margin="4">
            <ItemsControl ItemsSource="{Binding ElementName=This, Path=Displays}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Background="Transparent" Click="Button_Click" BorderThickness="0" CommandParameter="{Binding}" VerticalAlignment="Top">
                            <local:FileVertical ImageSource="{Binding ImageSource}" FileName="{Binding Name}" FileType="{Binding FileType}" 
                                                Background="Transparent" TextElement.Foreground="{StaticResource ThemeColor}" Width="96"/>
                        </Button>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</UserControl>
