<EgtWPFLib5:EgtCustomWindow x:Class="AddSectionXMaterialWndV"
                            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"
                            xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
                            xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core"
                            Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
                            WindowStyle="None" ResizeMode="NoResize"
                            SizeToContent="WidthAndHeight"
                            WindowStartupLocation="CenterOwner"
                            IsClosable="False"
                            IsMinimizable="False"
                            IsResizable="False"
                            Title="AddSectionXMaterial">
   <StackPanel Margin="5,5,5,0">
       
      <EgtBEAMWALLCORE:EgtDataGrid Grid.Row="0" Width="500" MaxHeight="600"
                               ItemsSource="{Binding NewSectionXMaterialList}" 
                               SelectedItem="{Binding SelNewSectionXMaterial}"
                               CanUserAddRows="False"
                               AutoGenerateColumns="False"
                               CanUserResizeRows="False"
                               SelectionMode="Single"
                               ScrollViewer.CanContentScroll="False" 
                               ScrollViewer.VerticalScrollBarVisibility="Auto"
                               ScrollViewer.HorizontalScrollBarVisibility="Auto"
                               Margin="5"
                               BindingColumns="{Binding SectXMatColumns}">
          <DataGrid.Resources>
              <!-- SectionXMaterial -->
              <DataGridTextColumn x:Key="colSECTXMAT" Binding="{Binding sSectionXMaterial}">
                  <DataGridTextColumn.HeaderTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding Path=DataContext.SectionXMaterial_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                      </DataTemplate>
                  </DataGridTextColumn.HeaderTemplate>
              </DataGridTextColumn>
              <!-- Alias -->
              <DataGridTemplateColumn x:Key="colALIAS">
                  <DataGridTemplateColumn.Header>
                      <TextBlock Text="{Binding Path=DataContext.Alias_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                  </DataGridTemplateColumn.Header>
                  <DataGridTemplateColumn.CellTemplate>
                  <DataTemplate>
                      <CheckBox IsChecked="{Binding Path=Alias_IsChecked, UpdateSourceTrigger=PropertyChanged}" 
                                IsEnabled="{Binding Alias_IsEnabled}"
                                HorizontalAlignment="Center"/>
                  </DataTemplate>
              </DataGridTemplateColumn.CellTemplate>
              </DataGridTemplateColumn>
              <!-- W -->
              <DataGridTextColumn x:Key="colW" Binding="{Binding sNewW}">
                  <DataGridTextColumn.HeaderTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding Path=DataContext.W_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                      </DataTemplate>
                  </DataGridTextColumn.HeaderTemplate>
                  <DataGridTextColumn.CellStyle>
                      <Style TargetType="DataGridCell">
                          <Setter Property="IsEnabled" Value="{Binding Alias_IsNotChecked}" />
                      </Style>
                  </DataGridTextColumn.CellStyle>
              </DataGridTextColumn>
              <!-- L -->
              <DataGridTextColumn x:Key="colL" Binding="{Binding sNewL}">
                  <DataGridTextColumn.HeaderTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding Path=DataContext.L_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                      </DataTemplate>
                  </DataGridTextColumn.HeaderTemplate>
                  <DataGridTextColumn.CellStyle>
                      <Style TargetType="DataGridCell">
                          <Setter Property="IsEnabled" Value="{Binding Alias_IsNotChecked}" />
                      </Style>
                  </DataGridTextColumn.CellStyle>
              </DataGridTextColumn>
              <!-- Material -->
              <DataGridTemplateColumn x:Key="colMATERIAL">
                  <DataGridTemplateColumn.Header>
                      <TextBlock Text="{Binding Path=DataContext.Material_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                  </DataGridTemplateColumn.Header>
                  <DataGridTemplateColumn.CellTemplate>
                  <DataTemplate>
                      <ComboBox ItemsSource="{Binding MaterialForSameSection_List}" 
                                SelectedItem="{Binding SelMaterialForSameSection, UpdateSourceTrigger=PropertyChanged}"
                                IsEnabled="{Binding Alias_IsChecked, UpdateSourceTrigger=PropertyChanged}"/>
                  </DataTemplate>
              </DataGridTemplateColumn.CellTemplate>
              </DataGridTemplateColumn>
              <!-- Quantity -->
              <DataGridTextColumn x:Key="colQTY" Binding="{Binding sQuantity}">
                  <DataGridTextColumn.HeaderTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding Path=DataContext.Quantity_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:AddSectionXMaterialWndV}}}"/>
                      </DataTemplate>
                  </DataGridTextColumn.HeaderTemplate>
                  <DataGridTextColumn.CellStyle>
                      <Style TargetType="DataGridCell">
                          <Setter Property="IsEnabled" Value="{Binding Alias_IsNotChecked}" />
                      </Style>
                  </DataGridTextColumn.CellStyle>
              </DataGridTextColumn>
          </DataGrid.Resources>
      </EgtBEAMWALLCORE:EgtDataGrid>

      <Grid Grid.Row="2" Margin="0,0,0,5">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="1*"/>
         </Grid.ColumnDefinitions>
         <Button Content="{Binding Ok_Msg}"
                 Command="{Binding Ok_Command}"
                 IsDefault="True"
                 Grid.Column="1"
                 Style="{StaticResource EgtWPFLib5_InputButton}"/>
         <Button Content="{Binding Cancel_Msg}"
                 Command="{Binding Cancel_Command}"
                 IsCancel="True"
                 Grid.Column="3"
                 Style="{StaticResource EgtWPFLib5_InputButton}"/>
      </Grid>

   </StackPanel>
</EgtWPFLib5:EgtCustomWindow>
