<fw:BaseWindow x:Class="Com.FirmLib.UI.Maintainer.WinAddProductType"
             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:uc="clr-namespace:Com.FirmLib.UI.Common"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:dgx="urn:tom-englert.de/DataGridExtensions"
             Name="this" Title="添加维修商型号"
            Height="550" Width="500" WindowStartupLocation="CenterOwner">
    <fw:BaseWindow.Resources>
        <fw:BindingProxy x:Key="DATA" Data="{Binding}"></fw:BindingProxy>
        <Style TargetType="DataGridRow">
            <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>
    </fw:BaseWindow.Resources>

    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid>
            <ComboBox Width="140" Margin="0,5" HorizontalAlignment="Left"
                      IsEditable="True"
                      ItemsSource="{Binding Root.Items}" SelectedItem="{Binding Root.CurrentItem}" DisplayMemberPath="RefItem.Name"></ComboBox>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <DataGrid x:Name="BrandGrid" Grid.Column="0" BorderThickness="1" BorderBrush="Black"  AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding Root.CurrentItem.Nodes}" SelectedItem="{Binding Root.CurrentItem.CurrentItem}"
                  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.Columns>
                    <fw:TDataGridTextColumn Width="*" Header="品牌名" Binding="{Binding RefItem.Name}" IsReadOnly="True"></fw:TDataGridTextColumn>
                </DataGrid.Columns>

            </DataGrid>

            <DataGrid x:Name="ProductGrid" Grid.Column="1" BorderThickness="1" BorderBrush="Black"   AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding Root.CurrentItem.CurrentItem.Nodes}" SelectedItem="{Binding Root.CurrentItem.CurrentItem.CurrentItem}"
                  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.Columns>
                    <fw:TDataGridTextColumn Width="*" Header="产品名" Binding="{Binding RefItem.Name}" IsReadOnly="True"></fw:TDataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>

            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                </Grid.RowDefinitions>

                <DataGrid x:Name="ProductTypeGrid" Grid.Row="0" BorderThickness="1" BorderBrush="Black"  AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding Root.CurrentItem.CurrentItem.CurrentItem.Nodes}" SelectedItem="{Binding Root.CurrentItem.CurrentItem.CurrentItem.CurrentItem,Mode=OneWay}"
                      CanUserAddRows="False"
                      CanUserDeleteRows="False"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Auto"
                      SelectionUnit="FullRow"
                      HeadersVisibility="Column" 
                      CanUserSortColumns="True"   
                      CellStyle="{StaticResource ResourceKey={x:Static uc:CommonStyles.DataGridCellKey}}"
                      AlternationCount="2">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn >
                            <DataGridTemplateColumn.Header>
                                <CheckBox IsChecked="{Binding Data.Root.CurrentItem.CurrentItem.CurrentItem.IsChecked,Source={StaticResource ResourceKey=DATA}}"></CheckBox>
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <CheckBox IsChecked="{Binding IsChecked,UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsEnabled}" VerticalAlignment="Center" HorizontalAlignment="Center"></CheckBox>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <fw:TDataGridTextColumn Width="*" Header="型号" Binding="{Binding RefItem.Name}" IsReadOnly="True" ></fw:TDataGridTextColumn>

                    </DataGrid.Columns>
                  
                </DataGrid>

                <StackPanel Grid.Row="1"  Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <Button Command="{Binding Commands.AddProductTypeCommand}" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="100"  Margin="0" Content="加入维修产品名" Click="btnOK_Click"/>

                </StackPanel>
            </Grid>

        </Grid>
    </Grid>
  
</fw:BaseWindow>
