<UserControl x:Class="HeBianGu.App.Disk.ExplorerControl"
             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:h="https://github.com/HeBianGu"
             xmlns:local="clr-namespace:HeBianGu.App.Disk"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             d:DesignHeight="450"
             d:DesignWidth="800"
             mc:Ignorable="d">
    <Grid>
        <DockPanel>
            <StackPanel Height="{DynamicResource {x:Static h:SystemKeys.RowHeight}}"
                        Background="{DynamicResource {x:Static h:BrushKeys.Dark0_3}}"
                        DockPanel.Dock="Top"
                        Orientation="Horizontal">

                <h:Interaction.Behaviors>
                    <h:LoadAnimationBehavior End="1" EndValue="0"
                                             IsUseAll="True"
                                             LoadAnimationType="HorizontalAlignment"
                                             Split="0.2"
                                             StartValue="1000" />
                </h:Interaction.Behaviors>

                <Button h:Cattach.Icon="&#xe892;" Command="{Binding UploadCommand}" Content="上传" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
                <Button h:Cattach.Icon="&#xe891;" Content="下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
                <Button h:Cattach.Icon="&#xe763;" Content="分享" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
                <Button h:Cattach.Icon="&#xe643;" Content="删除" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
                <Button h:Cattach.Icon="&#xe688;" Content="新建文件夹" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
                <Button h:Cattach.Icon="&#xe84f;" Content="离线下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
            </StackPanel>

            <h:Explorer Margin="0,0,10,0" CurrentPath="{Binding Path, Mode=TwoWay}" Style="{DynamicResource {x:Static h:Explorer.DefaultKey}}">
                <h:Interaction.Behaviors>
                    <h:LoadAnimationBehavior End="0.05"
                                             EndValue="1"
                                             IsUseAll="True"
                                             LoadAnimationType="Opactiy"
                                             Split="0.02"
                                             StartValue="0" />
                </h:Interaction.Behaviors>

                <h:Explorer.Columns>
                    <DataGridTemplateColumn Width="50" Header="">
                        <DataGridTemplateColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox Foreground="{Binding RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}, Path=Foreground}" />
                            </DataTemplate>
                        </DataGridTemplateColumn.HeaderTemplate>

                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Margin="0,0" HorizontalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource AncestorType=DataGridCell}, Path=Foreground}" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>

                    <DataGridTemplateColumn Width="3*" Header="文件名">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Image Margin="5" Source="{Binding Logo, Converter={x:Static h:XConverter.IconToImageSourceConverter}}" />
                                    <TextBlock Foreground="{Binding RelativeSource={RelativeSource AncestorType=DataGridCell}, Path=Foreground}" Style="{StaticResource {x:Static h:TextBlockKeys.Default}}" Text="{Binding Model.Name}" />
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>

                    <DataGridTextColumn Width="*" Binding="{Binding Model.LastWriteTime, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}" Header="修改时间" />
                    <DataGridTextColumn Width="*" Header="大小" />
                </h:Explorer.Columns>
            </h:Explorer>
        </DockPanel>
    </Grid>
</UserControl>
