<fw:BaseWindow x:Class="Com.FirmLib.UI.Manufacturer.WinProductEditor"
             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:wpf="clr-namespace:SAGA.DotNetUtils.WPF;assembly=SAGA.DotNetUtils"
             Name="this"
             Title="添加产品" Width="270" SizeToContent="Height" WindowStartupLocation="CenterOwner">
    <Grid Margin="5" Validation.ErrorTemplate="{StaticResource ResourceKey={x:Static fw:ResourceKeys.EmptyErrorTemplateKey}}">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.BindingGroup  >
            <BindingGroup x:Name="bg"  NotifyOnValidationError="False"/>
        </Grid.BindingGroup>
        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
            <Label  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.StarLableKey}}" Content="所属品牌:"></Label>

            <ComboBox ItemsSource="{Binding Brands,Mode=OneWay}" DisplayMemberPath="Name" SelectedValuePath="Value"   Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ComboBoxKey}}" Margin="5">
                <ComboBox.SelectedValue>
                    <Binding Path="CurrentBrandId" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                        <Binding.ValidationRules>
                            <fw:RequireValidationRule ></fw:RequireValidationRule>
                        </Binding.ValidationRules>
                    </Binding>
                </ComboBox.SelectedValue>
               
            </ComboBox>
            <Label  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.StarLableKey}}" Content="产品名:"></Label>

            <TextBox  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.TextBoxKey}}" Margin="5">
                <Binding Path="ProductName" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                    <Binding.ValidationRules>
                        <fw:RequireValidationRule ></fw:RequireValidationRule>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox>
            <Label  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.StarLableKey}}" Content="所属设备族:"></Label>

            <wpf:SComboBox ItemsSource="{Binding Families,Mode=OneWay}" DisplayMemberPath="Name" SelectedValuePath="Value" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ControlKey}}" Margin="5">
                <wpf:SComboBox.SelectedValue>
                    <Binding Path="CurrentFamily" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                        <Binding.ValidationRules>
                            <fw:RequireValidationRule ></fw:RequireValidationRule>
                        </Binding.ValidationRules>
                    </Binding>
                </wpf:SComboBox.SelectedValue>
            </wpf:SComboBox>
        </StackPanel>
        

        <fw:LineSpliter Grid.Column="0" Margin="5,0,5,0" Grid.Row="1" VerticalAlignment="Center" ></fw:LineSpliter>

        <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Command="{Binding Commands.AddCommand}" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="60"  Margin="10" Content="完成" Click="btnOK_Click"/>
            <Button Command="{Binding Commands.AddAndManageCommand}"  CommandParameter="{Binding ElementName=this}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Margin="10" Content="继续添加产品型号" Click="btnOK_Click"/>
        </StackPanel>

        <TextBlock Grid.Row="3" Grid.Column="0" Text="添加品牌后可在列表选择管理常见问题和包含类型" Opacity="0.7" TextWrapping="Wrap"></TextBlock>
    </Grid>
    </fw:BaseWindow>
