<fw:BaseWindow x:Class="Com.FirmLib.UI.Insuer.WinSimplePolicyEditor"
             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"
             Name="this" Title="保险单号"
            Height="300" Width="350" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Width="180">
                <Label  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.StarLableKey}}" Content="保单编号:"></Label>

                <TextBox IsEnabled="{Binding IsAdd}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.TextBoxKey}}" Margin="5">
                    <Binding Path="PolicyNo" Mode="TwoWay" UpdateSourceTrigger="LostFocus" >
                        <Binding.ValidationRules>
                            <fw:RequireValidationRule ></fw:RequireValidationRule>
                              <fw:LengthValidationRule MaxLength="50" ></fw:LengthValidationRule>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox>
                <Label   Content="保单截止日期:"></Label>
                <DatePicker    Margin="5">
                    <DatePicker.SelectedDate>
                        <Binding Path="PolicyEndDate" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" Converter="{x:Static fw:DateTimeConverter.Date}">
                            <Binding.ValidationRules>
                                <fw:RequireValidationRule ValidationStep="ConvertedProposedValue"></fw:RequireValidationRule>
                            </Binding.ValidationRules>
                        </Binding>
                    </DatePicker.SelectedDate>
                </DatePicker>

                <Label  Content="保险文件:"></Label>

                <Grid  HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBox Text="{Binding PolicyFile.Name}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.TextBoxKey}}" IsReadOnly="True" Margin="5">
                    </TextBox>
                    <Button Command="{Binding Commands.UploadCommand}" Grid.Column="1" Content="上传" Width="40" Height="23"></Button>
                </Grid>
            </StackPanel>

            <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Stretch" >
                <Label   Content=""></Label>
                <Button Margin="5" Command="{Binding Commands.SelectPolicyCommand}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}" Content="从已有保险单号中选择"></Button>
              
            </StackPanel>
        </Grid>
     

        <StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
            <Button Command="{Binding Commands.EnsureCommand}" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="60"  Margin="80,0,0,0" Content="确定" Click="btnOK_Click"/>
        </StackPanel>
    </Grid>
</fw:BaseWindow>
