<Grid x:Class="DoorListPageV"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:Effector.Plugin.StoneCut">
   <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="3"/>
      <RowDefinition Height="1*"/>
   </Grid.RowDefinitions>
   <Border BorderThickness="0"
           Padding="3"
           BorderBrush="Transparent"
           Background="{StaticResource Omag_DarkGray}">
      <StackPanel Orientation="Horizontal"
                  IsEnabled="{Binding bExecButton_IsEnabled}">
         <Button ToolTip="{Binding ProduceAll_Tooltip}"
                 Command="{Binding ProduceAll_Command}"
                 IsEnabled="{Binding bExecButton_IsEnabled}"
                 Style="{StaticResource Table_Button}">
            <Image Source="../Resources/DoorListPage/ProduceAll.png"
                   Style="{StaticResource Button.Image.DoorList}"/>
         </Button>
         <Button ToolTip="{Binding ResetProductionQueue_Tooltip}"
                 Command="{Binding ResetProductionQueue_Command}"
                 Style="{StaticResource Table_Button}">
            <Image Source="../Resources/DoorListPage/ResetProduction.png"
                   Style="{StaticResource Button.Image.DoorList}"/>
         </Button>
         <Button ToolTip="{Binding DeleteAll_Tooltip}"
                 Command="{Binding DeleteAll_Command}"
                 IsEnabled="{Binding bExecButton_IsEnabled}"   
                 Style="{StaticResource Table_Button}">
            <Image Source="../Resources/DoorListPage/DeleteAll.png"
                   Style="{StaticResource Button.Image.DoorList}"/>
         </Button>
      </StackPanel>
   </Border>
   <FrameworkElement x:Name="dummyElement" Visibility="Collapsed"/>
   <DataGrid Grid.Row="2"
             ItemsSource="{Binding DoorList}"
             AutoGenerateColumns="False"
             CanUserDeleteRows="False"
             CanUserResizeRows="False"
             SelectionMode="Single"
             SelectionUnit="FullRow"
             CanUserSortColumns="False"
             ScrollViewer.VerticalScrollBarVisibility="Auto"
             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
             BeginningEdit="DoorList_BeginningEdit"
             HorizontalGridLinesBrush="Transparent"
             VerticalGridLinesBrush="Transparent"
             ColumnHeaderHeight="32"
             HeadersVisibility="Column"
             FontSize="12"
             FontFamily="/Resources/Fonts/#Roboto"
             FontWeight="Regular"
             RowHeight="32"
             BorderThickness="0"
             Background="{StaticResource Omag_LightGray}">
      <DataGrid.ColumnHeaderStyle>
         <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="Background" Value="{StaticResource Omag_DarkGray}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="FontSize" Value="15"/>
            <Setter Property="Padding" Value="10,0,10,0"/>
         </Style>
      </DataGrid.ColumnHeaderStyle>
      <DataGrid.Columns>
         <DataGridTextColumn Binding="{Binding nId}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Id_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Binding="{Binding sFileNameWithoutExtension}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.FileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding DataContext.Produce_Command, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
                          CommandParameter="{Binding}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/Produce.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <DataGridTextColumn Binding="{Binding nTable}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Table_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Binding="{Binding sFileDimension}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.FileDimension_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Binding="{Binding sState}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.State_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Binding="{Binding sMachiningStart}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.MachiningStart_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Binding="{Binding sMachiningEnd}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.MachiningEnd_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTextColumn Header="{Binding sMachiningTime_Msg}"
                             Binding="{Binding sMachiningTime}"
                             Width="Auto"
                             IsReadOnly="True"
                             ElementStyle="{StaticResource TextBlock.DataGridTextColumn.DoorList}"
                             EditingElementStyle="{StaticResource TextBox.DataGridTextColumn.DoorList}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.MachiningTime_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding DataContext.MoveUp_Command, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
                          CommandParameter="{Binding}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/MoveUp.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding DataContext.MoveDown_Command, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
                          CommandParameter="{Binding}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/MoveDown.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding NotProduce_Command}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/NotProduce.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding DataContext.Copy_Command, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
                          CommandParameter="{Binding}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/Copy.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <DataGridTemplateColumn Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button Command="{Binding DataContext.Delete_Command, RelativeSource={RelativeSource AncestorType={x:Type local:DoorListPageV}}}"
                          CommandParameter="{Binding}"
                          Style="{StaticResource Table_Button}">
                     <Image Source="../Resources/DoorListPage/Delete.png"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
      </DataGrid.Columns>
      <!--<DataGrid.InputBindings>
         <KeyBinding Key="Delete" Command="{Binding Tag.SelectedMachGroup.DeleteMachGroup_Command,
                                                    RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
      </DataGrid.InputBindings>-->
      <DataGrid.RowStyle>
         <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
            <Setter Property="Background" Value="{Binding Background}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="Green"/>
            <Style.Triggers>
               <Trigger Property="IsSelected" Value="True">
                  <Setter Property="Background" Value="{Binding Background}"/>
                  <Setter Property="Foreground" Value="White"/>
                  <Setter Property="BorderBrush" Value="Green"/>
                  <Setter Property="BorderThickness" Value="2,0,2,0"/>
               </Trigger>
            </Style.Triggers>
         </Style>
      </DataGrid.RowStyle>
      <DataGrid.CellStyle>
         <Style TargetType="{x:Type DataGridCell}">
            <Setter Property="Background" Value="{Binding Background}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="{Binding Background}"/>
            <Style.Triggers>
               <Trigger Property="IsSelected" Value="True">
                  <Setter Property="Background" Value="{Binding Background}"/>
                  <Setter Property="Foreground" Value="White"/>
                  <Setter Property="BorderBrush" Value="{Binding Background}"/>
               </Trigger>
            </Style.Triggers>
         </Style>
      </DataGrid.CellStyle>
   </DataGrid>
</Grid>
