<fw:NChildWindow x:Class="Com.FirmLib.UI.Seller.WinSellerBaseInfo"
             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:fw="http://schemas.FWind/xaml"
             xmlns:wpf="clr-namespace:FWindSoft.Wpf;assembly=FWindSoft.Wpf"
             xmlns:uc="clr-namespace:Com.FirmLib.UI.Common"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:behaviors="clr-namespace:FWindSoft.Wpf.Behaviors;assembly=FWindSoft.Wpf"
                 xmlns:dgx="urn:tom-englert.de/DataGridExtensions"
             mc:Ignorable="d" Title="供应商名称"
             d:DesignHeight="300" d:DesignWidth="500" Name="this" Height="{Binding Height,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}"
                 Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ScrollContentPresenter}}" >
    <fw:NChildWindow.Resources>
        <wpf:BindingProxy x:Key="DATA" Data="{Binding}"></wpf:BindingProxy>
    </fw:NChildWindow.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
            <Button Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}" Command="{Binding Commands.AddCommand}"  Height="23"  Margin="10" Content="添加供应商"/>
            <Button Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Margin="10" Content="查看备选名片" />
        </StackPanel>

        <DataGrid Grid.Row="1" Grid.Column="0"   AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding Sellers}"
                CanUserAddRows="False"
                CanUserDeleteRows="False"
                VerticalScrollBarVisibility="Auto"
                HorizontalScrollBarVisibility="Auto"
                SelectionUnit="FullRow"
                HeadersVisibility="Column" 
                CanUserSortColumns="True"   
                  dgx:DataGridFilter.IsAutoFilterEnabled="True"
                CellStyle="{StaticResource ResourceKey={x:Static uc:CommonStyles.DataGridCellKey}}"
                  AlternationCount="2"
                >
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Setter Property="ContextMenu">
                        <Setter.Value>
                            <ContextMenu>
                                <MenuItem Header="删除" Command="{Binding Data.Commands.DeleteCommand,Source={StaticResource ResourceKey=DATA}}" CommandParameter="{Binding }"></MenuItem>
                            </ContextMenu>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Height" Value="30"></Setter>
                    <Style.Triggers>
                        <Trigger Property="ItemsControl.AlternationIndex"
                                 Value="0">
                            <Setter Property="Background" Value="White" />
                        </Trigger>
                        <Trigger Property="ItemsControl.AlternationIndex"
                                 Value="1">
                            <Setter Property="Background" Value="#FFE6E3DD" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="操作"  Width="60" IsReadOnly="True" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Command="{Binding DataContext.Commands.ManageCommand,ElementName=this}" CommandParameter="{Binding }" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}"  VerticalAlignment="Center"   Content="管理" HorizontalAlignment="Left" Padding="5,0,5,0"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>

                </DataGridTemplateColumn>
                <fw:TDataGridTextColumn Header="供应商名称" Width="100" IsReadOnly="True" 
                                        Binding="{Binding Path=Name}"></fw:TDataGridTextColumn>
                <fw:TDataGridTextColumn Header="供应商网址"  Width="*" IsReadOnly="True"  Binding="{Binding Path=Url}"></fw:TDataGridTextColumn>
                <fw:TDataGridTextColumn Header="供应品牌"  Width="*" IsReadOnly="True"  Binding="{Binding Path=BrandNames,Converter={x:Static wpf:ConverterFactory.ItemsToString}}"></fw:TDataGridTextColumn>
                <fw:TDataGridTextColumn Header="设备族"  Width="*" IsReadOnly="True"  Binding="{Binding Path=FamilyNames,Converter={x:Static wpf:ConverterFactory.ItemsToString}}"></fw:TDataGridTextColumn>
                <fw:TDataGridTextColumn Header="供应的项目"  Width="*" IsReadOnly="True"  Binding="{Binding Path=RefProjectCount}"></fw:TDataGridTextColumn>
            </DataGrid.Columns>
            <i:Interaction.Behaviors>
                <behaviors:GridCellSingleClickEditBehavior></behaviors:GridCellSingleClickEditBehavior>
            </i:Interaction.Behaviors>

        </DataGrid>
    </Grid>
</fw:NChildWindow>
