<UserControl x:Class="SlnMesnac.WPF.Page.ProductInfo.ProductInfoControl"
             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:local="clr-namespace:SlnMesnac.WPF.Page.ProductInfo"
             xmlns:local1="clr-namespace:SlnMesnac.WPF.Converter.Generate"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Background="Transparent">
    <Control.Resources>
        <local1:RowToIndexConverter x:Key="RowToIndexConverter" />
    </Control.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="8*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" Background="White" BorderBrush="White" BorderThickness="2" CornerRadius="5" Margin="0,10,0,10">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">

                <TextBlock Text="产品编号:" FontSize="20" Foreground="Black" VerticalAlignment="Center" Margin="10,0,10,0"/>
                <TextBox Text="{Binding ProductCodeStr}" Foreground="Black" FontSize="18" Width="200" Height="35"/>
                
                <TextBlock Text="产品名称:" FontSize="20" Foreground="Black" VerticalAlignment="Center" Margin="30,0,10,0"/>
                <TextBox Text="{Binding ProductNameStr}" Foreground="Black" FontSize="18" Width="200" Height="35"/>

                <Button Content="查  询" FontSize="16" Foreground="White" Width="120" Height="35" Background="#007DFA" BorderBrush="#007DFA" Margin="20,0,10,0" Command="{Binding QueryProductInfoCommand}" />

            </StackPanel>
        </Border>
        <Border Grid.Row="1" Background="White" BorderBrush="White" BorderThickness="2" CornerRadius="5" Margin="0,0,0,10">
            <DataGrid x:Name="datagrid" Grid.Row="0" ItemsSource="{Binding ProductInfoItems}" Background="Transparent" 
                FontSize="15" ColumnHeaderHeight="55" 
                RowHeight="55" AutoGenerateColumns="False" RowHeaderWidth="0" 
                GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
                Foreground="Black" >
                <!--resourceStyle 399行修改选中字体颜色-->
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding productCode}" Header="产品编号" Width="3*" IsReadOnly="True"/>
                    <DataGridTextColumn Binding="{Binding productSeries}" Header="产品系列" Width="3*" IsReadOnly="True"/>
                    <DataGridTextColumn Binding="{Binding productName}" Header="产品名称" Width="3*" IsReadOnly="True"/>
                    <DataGridTemplateColumn Header="操作" Width="2*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="产品信息" CommandParameter="{Binding productCode}" Background="#009999" Foreground="White" Margin="10,0,0,0" Height="30" BorderBrush="#009999" BorderThickness="0" Width="100" Command="{Binding DataContext.EditProductInfoCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid  }}"/>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>

                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </Border>
    </Grid>
</UserControl>

