<fw:BaseWindow x:Class="Com.FirmLib.UI.Seller.WinSupplyAssetCreater"
             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:dgx="urn:tom-englert.de/DataGridExtensions"
             Name="this" Title="创建供应的新资产"
             Height="550" Width="600"  WindowStartupLocation="CenterOwner">
    <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition Height="30"></RowDefinition>
            </Grid.RowDefinitions>

        <StackPanel Margin="0,10" Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Stretch">
            <fw:LabelEditor Header="采购数量" Orientation="Horizontal" LabelWidth="60" LabelHeight="100" LabelHorizontalAlignment="Left">
                <fw:IntegerSpinner Width="120"  Value="{Binding AssetCount,Mode=TwoWay}" Minimum="1" Maximum="100"   ForceType="KeyDown"></fw:IntegerSpinner>
            </fw:LabelEditor>
          
        </StackPanel>

        <Grid Grid.Row="1">
             <Grid.RowDefinitions>
                 <RowDefinition Height="Auto"></RowDefinition>
                 <RowDefinition></RowDefinition>
             </Grid.RowDefinitions>
             <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
               
                <TextBlock Text="基础信息" Margin="0,0,5,0"></TextBlock>
                 <Border Grid.Column="1" HorizontalAlignment="Stretch"  VerticalAlignment="Center" Height="1" BorderThickness="1" BorderBrush="Black"></Border>
            </Grid>

            <Grid Grid.Row="1" Margin="0,10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
             
                <fw:LabelEditor Header="型号" Orientation="Vertical" Margin="3,3,20,3">
                    <fw:ButtonDecorator Grid.Row="1" Description="…" Command="{Binding Commands.SelectProductType}" ButtonStyle="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}">
                        <TextBox BorderThickness="0" IsReadOnly="True" Text="{Binding CurrentProductType,Mode=OneWay}"></TextBox>
                    </fw:ButtonDecorator>
                </fw:LabelEditor>

                <fw:LabelEditor Grid.Column="1" Header="采购价格"  Orientation="Vertical" Margin="3,3,20,3">
                    <fw:DescriptionDecorator  Description="元"  >
                        <fw:TTextBox Text="{Binding Price, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0">
                            <fw:TTextBox.TextControl>
                                <fw:AccessPlusDecimal></fw:AccessPlusDecimal>
                            </fw:TTextBox.TextControl>
                        </fw:TTextBox>
                    </fw:DescriptionDecorator>
                </fw:LabelEditor>

                <fw:LabelEditor Grid.Column="2" Header="保修期" Orientation="Vertical" Margin="3,3,20,3">
                    <fw:DescriptionDecorator  Description="年"  >
                        <fw:TTextBox Text="{Binding MaintenancePeriod, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0">
                            <fw:TTextBox.TextControl>
                                <fw:AccessPlusDecimal></fw:AccessPlusDecimal>
                            </fw:TTextBox.TextControl>
                        </fw:TTextBox>
                    </fw:DescriptionDecorator>
                </fw:LabelEditor>

                
            </Grid>
            
        </Grid>

        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Text="资产信息" Margin="0,0,5,0"></TextBlock>
                <Border Grid.Column="1" HorizontalAlignment="Stretch"  VerticalAlignment="Center" Height="1" BorderThickness="1" BorderBrush="Black"></Border>
            </Grid>

            <DataGrid  x:Name="ProductTypeGrid" Grid.Row="1" VirtualizingPanel.IsVirtualizing="False"  AutoGenerateColumns="False" SelectionMode="Single"  FrozenColumnCount="1" ItemsSource="{Binding AssetItems}"
                      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 Header="序号" Width="40" IsReadOnly="True" Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow,Mode=FindAncestor},Converter= {x:Static fw:ConverterFactory.RowIndex}}"></fw:TDataGridTextColumn>
              

                    <DataGridTemplateColumn Width="100" Header="本地名称">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding LocalName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="100" Header="本地编码">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding LocalCode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="100" Header="资产编号">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding AssetNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="100" Header="生产日期">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <DatePicker >
                                    <DatePicker.SelectedDate>
                                        <Binding Path="ProductionDate" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" Converter="{x:Static fw:DateTimeConverter.Date}">
                                        </Binding>
                                    </DatePicker.SelectedDate>
                                </DatePicker>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="100" Header="出厂编号">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding ManufacturingNo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>

        </Grid>

        <StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Command="{Binding Commands.CreateAssetItem}" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="60"   Content="确定创建资产" Click="btnOK_Click"/>
        </StackPanel>
    </Grid>
</fw:BaseWindow>
