<fw:BaseWindow x:Class="Com.FirmLib.UI.Manufacturer.WinBrandEditor"
             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"
 
             Title="添加品牌"  Name="this"
             Width="270" SizeToContent="Height" WindowStartupLocation="CenterOwner">
    <fw:BaseWindow.Resources>
        <fw:BindingProxy x:Key="DATA" Data="{Binding}"></fw:BindingProxy>
    </fw:BaseWindow.Resources>
    <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"/>
        </Grid.BindingGroup>
        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
            <Label  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.StarLableKey}}" Content="品牌名:"></Label>

            <TextBox Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.TextBoxKey}}" Margin="5">
                <Binding Path="BranchName" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                    <Binding.ValidationRules>
                        <fw:RequireValidationRule ></fw:RequireValidationRule>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox>
          
            <Label  Content="LOGO:"></Label>
            <Border Height="100" Width="100" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Background="{Binding ImageBrush}"  MouseMove="Border_MouseMove" MouseLeftButtonDown="Border_MouseLeftButtonDown">
                <!--<Image Stretch="Uniform" x:Name="image"  >-->
                  
                    <fw:MaskOptions.MaskTemplate>
                    <ControlTemplate>
                        <Border Background="Gray" Opacity="0.5">
                            <Button Command="{Binding Data.Commands.UploadCommand,Source={StaticResource DATA}}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Border}}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}"   Content="上传图片"></Button>
                        </Border>
                    </ControlTemplate>
                </fw:MaskOptions.MaskTemplate>
                <!--</Image>-->
            </Border>
        </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 Name="btnAddProduct" Command="{Binding Commands.AddProductCommand}"  Click="btnOK_Click" CommandParameter="{Binding ElementName=this}"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Width="140"  Margin="10" Content="继续添加品牌所含产品"/>
        </StackPanel>
        <StackPanel Name="stackDelete" Grid.Row="3" Orientation="Horizontal"  VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Command="{Binding Commands.DeleteCommand}" CommandParameter="{Binding ElementName=this}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}"  Height="23" Width="80"  Margin="10" Content="删除该品牌"/>
            
        </StackPanel>
    </Grid>
</fw:BaseWindow>

