<UserControl x:Class="MainShell.Recipe.View.CarrierRecipeView"
             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:MainShell.Recipe.View"
             xmlns:mw="http://www.maxwell-gp.com/"
             mc:Ignorable="d" 
             d:DesignHeight="850" d:DesignWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <GroupBox DataContext="{Binding CarrierRecipe.CarrierInfo}" Header="{DynamicResource CarrierInfo}">
                <UniformGrid Rows="7" Columns="1">
                    <UniformGrid.Resources>
                        <Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle}">
                           
                        </Style>
                       
                    </UniformGrid.Resources>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Style="{StaticResource TextBlockStyle}" Text="{DynamicResource CarrierWidth}"/>
                        <mw:NumberBox Width="120" Grid.Column="1" Value="{Binding Width}"  Maximum="300" Minimum="50" mw:NumericKeypadAttach.IsEnabled="True"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120"  mw:NumericKeypadAttach.IsEnabled="True"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Style="{StaticResource TextBlockStyle}" Text="{DynamicResource CarrierHeight}"/>
                        <mw:NumberBox Width="120" Grid.Column="1" Value="{Binding Height}" Maximum="300" Minimum="50"  mw:NumericKeypadAttach.IsEnabled="True"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120"  mw:NumericKeypadAttach.IsEnabled="True"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Style="{StaticResource TextBlockStyle}" Text="{DynamicResource CarrierThickness}"/>
                        <mw:NumberBox Width="120" Grid.Column="1" Value="{Binding Thickness}" Maximum="300" Minimum="50"  mw:NumericKeypadAttach.IsEnabled="True"/>
                    </Grid>
                </UniformGrid>
            </GroupBox>
            <GroupBox Grid.Column="1" Header="{DynamicResource SubstrateSelect}">
                <Grid>
                    <Border BorderThickness="0,0,0,0.5" BorderBrush="{DynamicResource BorderBrush}" >
                        <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <DataGrid x:Name="selectSubstrateInfo"
                                  ItemsSource="{Binding CarrierRecipe.SubstrateSelectInfos}"
                                  AutoGenerateColumns="False"
                                  CanUserSortColumns="False"
                                  SelectionMode="Single">
                            <DataGrid.Columns>
                                <DataGridComboBoxColumn Width="*" Header="{DynamicResource SubstrateRecipe}" TextBinding="{Binding SubstrateName}">
                                    <DataGridComboBoxColumn.EditingElementStyle>
                                        <Style TargetType="ComboBox">
                                            <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GroupBox}, Path=DataContext.SubstrateRecipes}" />
                                                <Setter Property="DisplayMemberPath" Value="RecipeName"/>
                                                <Setter Property="SelectedIndex" Value="0"/>
                                            </Style>
                                    </DataGridComboBoxColumn.EditingElementStyle>
                                </DataGridComboBoxColumn>
                                    <DataGridTextColumn Width="*"  Header="{DynamicResource Description}" Binding="{Binding Description}"/>
                            </DataGrid.Columns>
                        </DataGrid>
                    </ScrollViewer>
                    </Border>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,10">
                        <Button Content="{DynamicResource Add}" Style="{StaticResource StartButtonStyle}" Click="{mw:Action AddSubstrate}"/>
                        <Button Content="{DynamicResource Delete}" Style="{StaticResource CloseButtonStyle}" 
                                Command="{Binding RemoveSubstrateCommand}" 
                                CommandParameter="{Binding ElementName=selectSubstrateInfo, Path=SelectedItem}"/>
                    </StackPanel>
                </Grid>
            </GroupBox>
        </Grid>
        <GroupBox Grid.Row="1" Header="{DynamicResource LogisticsInfo}">
            
        </GroupBox>
    </Grid>
</UserControl>
