<EgtWPFLib5:EgtCustomWindow x:Class="OnlyProdWarehouseWndV"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
                            Width="{Binding WarehouseWnd_Width, Mode=TwoWay}"
                            xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
                            xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core"
                            Style="{StaticResource OnlyProd_EgtCustomWindow}"
                            WindowStyle="None" ResizeMode="NoResize"
                            SizeToContent="Height"
                            MinHeight="300"
                            MinWidth="300"
                            MaxHeight="700"
                            ShowInTaskbar="False"
                            WindowStartupLocation="CenterOwner"
                            IsClosable="True"
                            IsMinimizable="False"
                            IsResizable="True"
                            Title="WarehouseWndV"
                            Name="WarehouseWndV">

   <Grid Margin="5,5,5,0">
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="1*"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Grid >
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
         </Grid.RowDefinitions>

         <TextBlock Grid.Row="0"
                    Text="{Binding CurrentS_Msg}"
                    Visibility="{Binding Basic_Visibility}"
                    Style="{StaticResource OnlyProdPartParam_TextBlock}"/>
         <ComboBox Grid.Row="0"
                   Grid.Column="1"
                   ItemsSource="{Binding Path=SParamList, 
                                         Mode=OneWay}"
                   SelectedItem="{Binding Path=SelCurrentS, 
                                          Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                   DisplayMemberPath="sValue"
                   Visibility="{Binding Basic_Visibility}"
                   Style="{StaticResource OnlyProdWarehouse_ComboBox}"/>

         <TextBlock Grid.Row="1"
                    Text="{Binding StartOffset_Msg}"
                    Visibility="{Binding StartOffset_Visibility}"
                    Style="{StaticResource OnlyProdPartParam_TextBlock}"/>
         <EgtWPFLib5:EgtTextBox Grid.Row="1"
                                Grid.Column="1"
                                Text="{Binding dStartOffset, UpdateSourceTrigger=PropertyChanged}"
                                Visibility="{Binding StartOffset_Visibility}"
                                Style="{StaticResource Warehouse_TextBox}"/>

         <TextBlock Grid.Row="1"
                    Text="{Binding Kerf_Msg}"
                    Visibility="{Binding Kerf_Visibility}"
                    Style="{StaticResource PartParam_TextBlock}"/>
         <EgtWPFLib5:EgtTextBox Grid.Row="1"
                                Grid.Column="1"
                                Text="{Binding dKerf, UpdateSourceTrigger=PropertyChanged}"
                                Visibility="{Binding Kerf_Visibility}"
                                Style="{StaticResource Warehouse_TextBox}"/>

         <TextBlock Grid.Row="2"
                    Text="{Binding Offset_Msg}"
                    Visibility="{Binding Offset_Visibility}"
                    Style="{StaticResource PartParam_TextBlock}"/>
         <EgtWPFLib5:EgtTextBox Grid.Row="2"
                                Grid.Column="1"
                                Text="{Binding dOffset, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                                Visibility="{Binding Offset_Visibility}"
                                Style="{StaticResource Warehouse_TextBox}"/>

         <TextBlock Grid.Row="3"
                    Text="{Binding Quantity_Msg}"
                    Visibility="{Binding Basic_Visibility}"
                    Style="{StaticResource PartParam_TextBlock}"/>
         <EgtWPFLib5:EgtTextBox Grid.Row="3"
                                Grid.Column="1"
                                Text="{Binding nQuantity, UpdateSourceTrigger=PropertyChanged}"
                                Visibility="{Binding Basic_Visibility}"
                                Style="{StaticResource Warehouse_TextBox}"/>

         <GroupBox Grid.Row="3" 
                   Grid.ColumnSpan="3"
                   Header="{Binding Offset_Msg}"
                   Visibility="{Binding MediumWall_Visibility}"
                   Margin="0,0,0,5">
            <Grid Grid.Row="3" 
                  Grid.ColumnSpan="3">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="1*"/>
               </Grid.RowDefinitions>

               <Grid Grid.Row="0" 
                     Grid.Column="0">
                  <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="1*"/>
                     <ColumnDefinition Width="1*"/>
                     <ColumnDefinition Width="1*"/>
                  </Grid.ColumnDefinitions>
                  <TextBlock Grid.Column="0"
                             Text="{Binding MinThickness_Msg}"
                             Style="{StaticResource OnlyProdNestingRunningWndV_TextBlock}"/>
                  <TextBlock Grid.Column="1"
                             Text="{Binding Value_Msg}"
                             Style="{StaticResource OnlyProdNestingRunningWndV_TextBlock}"/>
                  <TextBlock Grid.Column="2"
                             Text="{Binding MaxThickness_Msg}"
                             Style="{StaticResource OnlyProdNestingRunningWndV_TextBlock}"/>
               </Grid>

               <Button Content="+" 
                       Grid.Column="1"
                       Command="{Binding AddWhWallParam_Command}"
                       Style="{StaticResource OnlyProdWWnd_SmallButton}"/>
               <Button Content="-" 
                       Grid.Column="2"
                       Command="{Binding RemoveWhWallParam_Command}"
                       Style="{StaticResource OnlyProdWWnd_SmallButton}"/>

               <Grid Grid.Row="1" 
                     Grid.Column="0">
                  <EgtWPFLib5:EgtScrollViewer Focusable="False" MaxHeight="200" VerticalScrollBarVisibility="Auto">
                     <ItemsControl ItemsSource="{Binding WhWallParamList}">
                        <ItemsControl.ItemTemplate>
                           <DataTemplate>
                              <Grid>
                                 <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1*" />
                                    <ColumnDefinition Width="1*" />
                                    <ColumnDefinition Width="1*" />
                                 </Grid.ColumnDefinitions>
                                 <TextBlock Grid.Column="0"
                                            Text="{Binding dMinThickness, Mode=OneWay}"
                                            Style="{StaticResource OnlyProdWarehouseWndV_TextBlock}"/>
                                 <EgtWPFLib5:EgtTextBox Grid.Column="1"
                                                        Text="{Binding dOffset, UpdateSourceTrigger=Explicit}"
                                                        Style="{StaticResource OnlyProdWarehouseWndV_TextBox}"/>
                                 <EgtWPFLib5:EgtTextBox Grid.Column="2"
                                                        Text="{Binding dMaxThickness, UpdateSourceTrigger=Explicit}"
                                                        Style="{StaticResource OnlyProdWarehouseWndV_TextBox}"/>
                              </Grid>
                           </DataTemplate>
                        </ItemsControl.ItemTemplate>
                     </ItemsControl>
                  </EgtWPFLib5:EgtScrollViewer>
               </Grid>
            </Grid>
         </GroupBox>
      </Grid>

      <GroupBox Grid.Row="1" 
                Grid.Column="0"
                Header="{Binding SParams_Msg}" 
                Visibility="{Binding Basic_Visibility}"
                Margin="0,0,0,5">
         <ListBox ItemsSource="{Binding SParamList}" 
                  SelectedItem="{Binding SelSParam}"
                  DisplayMemberPath="sValue"
                  Style="{StaticResource OnlyProdWarehouseWndV_ListBox}"/>
      </GroupBox>

      <GroupBox Grid.Row="1" 
                Grid.Column="0"
                Header="{Binding SParams_Msg}"
                Visibility="{Binding Medium_Visibility}"
                Margin="0,0,0,5">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0"
                  Style="{StaticResource OnlyProdAddPart_Grid}">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <Button Grid.Column="2"
                       Content="+" 
                       Command="{Binding AddMediumParam_Command}"
                       Style="{StaticResource OnlyProdWWnd_SmallButton}"/>
               <Button Grid.Column="3"
                       Content="-" 
                       Command="{Binding RemoveMediumParam_Command}"
                       Style="{StaticResource OnlyProdWWnd_SmallButton}"/>
            </Grid>
            <EgtBEAMWALLCORE:EgtDataGrid Grid.Row="1"
                                         ItemsSource="{Binding SParamList}" 
                                         SelectedItem="{Binding SelSParam}"
                                         SelectionMode="Single"
                                         AlternatingRowBackground="{StaticResource BeamWall_LinkWater}"
                                         AlternationCount="2"
                                         ColumnHeaderBackground="{StaticResource BeamWall_Teal}"
                                         ColumnHeaderForeground="{StaticResource Omag_White}"
                                         ColumnHeaderHorizontalContentAlignment="Center"
                                         ColumnHeaderFontWeight="Bold"
                                         ColumnHeaderFontSize="15"
                                         ColumnHeaderPadding="0,2,0,2"
                                         BindingColumns="{Binding SParamColumns}"
                                         Style="{StaticResource DataGrid_OnlyProd}"
                                         CellStyle="{StaticResource CellDataGrid_CustomHighLight}"
                                         RowStyle="{StaticResource RowDataGrid_CustomHighLight}">
               <DataGrid.Resources>
                  <!-- Active -->
                  <DataGridTemplateColumn x:Key="colACTIVE">
                     <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                           <CheckBox IsChecked="{Binding bActive, UpdateSourceTrigger=PropertyChanged}"
                                     VerticalAlignment="Center"/>
                        </DataTemplate>
                     </DataGridTemplateColumn.CellTemplate>
                  </DataGridTemplateColumn>
                  <!-- SectionXMaterial -->
                  <DataGridComboBoxColumn x:Key="colSECTXMAT"
                                          DisplayMemberPath="sSectionXMaterial"
                                          SortMemberPath="SectionXMaterialDisplayOrder">
                     <DataGridComboBoxColumn.HeaderTemplate>
                        <DataTemplate>
                           <TextBlock Text="{Binding Path=DataContext.SectionXMaterial_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}}"/>
                        </DataTemplate>
                     </DataGridComboBoxColumn.HeaderTemplate>
                     <DataGridComboBoxColumn.ElementStyle>
                        <Style TargetType="ComboBox" BasedOn="{StaticResource OnlyProd_ComboBox}">
                           <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}, Path=DataContext.SectionXMaterialList}"/>
                           <Setter Property="SelectedItem" Value="{Binding SectXMat, UpdateSourceTrigger=PropertyChanged}" />
                           <Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
                           <Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
                        </Style>
                     </DataGridComboBoxColumn.ElementStyle>
                     <DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="ComboBox" BasedOn="{StaticResource OnlyProd_ComboBox}">
                           <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}, Path=DataContext.SectionXMaterialList}"/>
                           <Setter Property="SelectedItem" Value="{Binding SectXMat, UpdateSourceTrigger=PropertyChanged}" />
                           <Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
                           <Setter Property="Width" Value="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"/>
                        </Style>
                     </DataGridComboBoxColumn.EditingElementStyle>
                  </DataGridComboBoxColumn>
                  <!-- W -->
                  <DataGridTextColumn x:Key="colW" Binding="{Binding dW}">
                     <DataGridTextColumn.HeaderTemplate>
                        <DataTemplate>
                           <TextBlock Text="{Binding Path=DataContext.W_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}}"/>
                        </DataTemplate>
                     </DataGridTextColumn.HeaderTemplate>
                  </DataGridTextColumn>
                  <!-- L -->
                  <DataGridTextColumn x:Key="colL" Binding="{Binding dL}">
                     <DataGridTextColumn.HeaderTemplate>
                        <DataTemplate>
                           <TextBlock Text="{Binding Path=DataContext.L_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}}"/>
                        </DataTemplate>
                     </DataGridTextColumn.HeaderTemplate>
                  </DataGridTextColumn>
                  <!-- Quantity -->
                  <DataGridTextColumn x:Key="colQTY" Binding="{Binding nQuantity}">
                     <DataGridTextColumn.HeaderTemplate>
                        <DataTemplate>
                           <TextBlock Text="{Binding Path=DataContext.Quantity_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdWarehouseWndV}}}"/>
                        </DataTemplate>
                     </DataGridTextColumn.HeaderTemplate>
                  </DataGridTextColumn>
               </DataGrid.Resources>
            </EgtBEAMWALLCORE:EgtDataGrid>
         </Grid>
      </GroupBox>

      <Grid Grid.Row="2" 
            Visibility="{Binding AddRemoveBtns_Visibility}"
            Style="{StaticResource OnlyProdAddPart_Grid}">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
         </Grid.RowDefinitions>
         <Button Grid.Row="1"
                 Grid.Column="0"
                 Content="+"
                 Command="{Binding AddParam_Command}"
                 Style="{StaticResource OnlyProdWarehouseWndV_Button}">
         </Button>

         <Button Grid.Row="1"
                 Grid.Column="1"
                 Content="-"  
                 Command="{Binding RemoveParam_Command}"
                 Style="{StaticResource OnlyProdWarehouseWndV_Button}">
         </Button>
      </Grid>

      <GroupBox Grid.Row="3"
                Header="{Binding NewParam_Msg}" 
                Visibility="{Binding NewBeamParam_Visibility}"
                Margin="0,0,0,5">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition Height="1*"/>
               <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="1*"/>
               <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding L_Msg}"
                       Style="{StaticResource PartParam_TextBlock}"/>
            <EgtWPFLib5:EgtTextBox Grid.Column="1"
                                   Text="{Binding sNewL, UpdateSourceTrigger=PropertyChanged}"
                                   Style="{StaticResource New_TextBox}"/>
            <Grid Grid.Row="1" 
                  Grid.ColumnSpan="2">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="1*"/>
               </Grid.ColumnDefinitions>
               <Button Grid.Column="0"
                       Content="{Binding OkAddParam_Msg}"
                       Command="{Binding OkAddParam_Command}"
                       Style="{StaticResource OKAddParam_Button}">
               </Button>
               <Button Grid.Column="1"
                       Content="{Binding Cancel_Msg}"
                       Command="{Binding CancelAddParam_Command}"
                       Style="{StaticResource CancelAddParam_Button}">
               </Button>
            </Grid>
         </Grid>
      </GroupBox>

      <GroupBox Grid.Row="3"
                Header="{Binding NewParam_Msg}" 
                Visibility="{Binding NewWallParam_Visibility}"
                Margin="0,0,0,5">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition Height="1*"/>
               <RowDefinition Height="1*"/>
               <RowDefinition Height="1.2*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="1*"/>
               <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding W_Msg}"
                       Style="{StaticResource PartParam_TextBlock}"/>
            <EgtWPFLib5:EgtTextBox Grid.Column="1"
                                   Text="{Binding sNewW, UpdateSourceTrigger=PropertyChanged}"
                                   Style="{StaticResource New_TextBox}"/>
            <TextBlock Grid.Row="1"
                       Text="{Binding L_Msg}"
                       Style="{StaticResource PartParam_TextBlock}"/>
            <EgtWPFLib5:EgtTextBox Grid.Row="1"
                                   Grid.Column="1"
                                   Text="{Binding sNewL, UpdateSourceTrigger=PropertyChanged}"
                                   Style="{StaticResource New_TextBox}"/>
            <Grid Grid.Row="2" 
                  Grid.ColumnSpan="2">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="368*"/>
                  <ColumnDefinition Width="117*"/>
                  <ColumnDefinition Width="251*"/>
               </Grid.ColumnDefinitions>
               <Button Grid.Column="0"
                       Content="{Binding OkAddParam_Msg}"
                       Command="{Binding OkAddParam_Command}"
                       Style="{StaticResource OKAddParam_Button}">
               </Button>
               <Button Grid.Column="1"
                       Grid.ColumnSpan="2"
                       Content="{Binding Cancel_Msg}"                       
                       Command="{Binding CancelAddParam_Command}"
                       Style="{StaticResource CancelAddParam_Button}">
               </Button>
            </Grid>
         </Grid>
      </GroupBox>

      <Grid Grid.Row="4"
            Style="{StaticResource OnlyProdAddPart_Grid}">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
         </Grid.ColumnDefinitions>
         <Button Grid.Column="0"
                 Content="{Binding Save_Msg}"
                 Command="{Binding Save_Command}"
                 Style="{StaticResource OKAddParam_Button}">
         </Button>
         <Button Grid.Column="1"
                 Content="{Binding Cancel_Msg}"
                 Command="{Binding Cancel_Command}"
                 Style="{StaticResource CancelAddParam_Button}">
         </Button>
      </Grid>

   </Grid>

</EgtWPFLib5:EgtCustomWindow>
