<UserControl x:Class="Txgy.EWS.Client.SysModule.Views.FileUploadView"
             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:Txgy.EWS.Client.SysModule.Views"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/BaseResources.xaml"/>
                <ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/ButtonStyles.xaml"/>
                <ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/TextBoxStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="20">
        <!--<TextBlock Text="上传" FontSize="50"/>-->
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border BorderBrush="#DDD" BorderThickness="0,0,0,1"/>
        <TextBox Text="" VerticalAlignment="Center" Width="300" HorizontalAlignment="Left" Style="{DynamicResource SearchTextBoxStyle}"/>
        <StackPanel VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal">
            <Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Background="#FF0ABEFF" 
                    Width="70" Margin="5,0"
                    Command="{Binding RefreshCommand}"/>
            <Button Content="上传" 
                Style="{StaticResource IconWithContentButtonStyle}" Width="100"
                Tag="&#xe603;" Background="#FFF05005"
                Command="{Binding AddCommand}"/>
        </StackPanel>

        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Border Background="#F7F9FA"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50"/>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="100"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="序号" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock Text="文件名称" VerticalAlignment="Center" Grid.Column="1"/>
                <TextBlock Text="上传时间" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2"/>
                <TextBlock Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="3"/>
            </Grid>
            <ItemsControl ItemsSource="{Binding Files}" Grid.Row="1">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Height="35" Name="root" Background="Transparent">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="2*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="100"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding Index}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <TextBlock Text="{Binding FileName}" VerticalAlignment="Center" Grid.Column="1"/>
                            <TextBlock Text="{Binding UploadTime}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" />
                            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="3">
                                <Hyperlink Command="{Binding DeleteCommand}"
                                           CommandParameter="{Binding}">删除</Hyperlink>
                            </TextBlock>
                        </Grid>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="#F7F9FA" TargetName="root"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
    </Grid>
</UserControl>
