<fw:BaseWindow x:Class="Com.FirmLib.UI.Insuer.WinPolicySelector"
             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"
             Name="this" Title="从已有的保单号中选择"
            Height="400" Width="350" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
    <fw:BaseWindow.Resources>
        <fw:BindingProxy x:Key="DATA" Data="{Binding}"></fw:BindingProxy>
    </fw:BaseWindow.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <DataGrid Name="DataGrid" Grid.Row="0" Grid.Column="0"   AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding PolicyItems}" SelectedItem="{Binding CurrentPolicyItem,Mode=TwoWay}"
                  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.RowStyle>
                <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>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <fw:TDataGridTextColumn Header="保单号" Width="*" IsReadOnly="True"  Binding="{Binding Path=PolicyNo}"></fw:TDataGridTextColumn>
                <fw:TDataGridTextColumn Header="保单截止日期" Width="*" IsReadOnly="True"  Binding="{Binding Path=EndDate}"></fw:TDataGridTextColumn>
            </DataGrid.Columns>
             <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <i:InvokeCommandAction Command="{Binding Data.Commands.SelectCommand,Source={StaticResource ResourceKey=DATA}}" CommandParameter="{Binding SelectedItem,ElementName=DataGrid}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </DataGrid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Command="{Binding Commands.EnsureCommand}" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="60"   Content="确定" Click="btnOK_Click"/>

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