<Grid x:Class="LeftPanelV"
      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.Supervisor"
      Width="Auto">

   <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="{Binding GridDims[0].GridLen, Mode=TwoWay}"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
   </Grid.RowDefinitions>
   <GroupBox Header="{Binding Channel_Msg}"
             Visibility="{Binding Channel_Visibility}">
      <ComboBox ItemsSource="{Binding ChannelList}"
                SelectedItem="{Binding SelChannel}"
                DisplayMemberPath="Name"/>
   </GroupBox>

   <GroupBox Grid.Row="1" Header="{Binding OPMode_Msg}"
             Visibility="{Binding OPMode_Visibility}">
      <ComboBox ItemsSource="{Binding OPModeList}"
                SelectedItem="{Binding SelOPMode}"
                DisplayMemberPath="Name"/>
   </GroupBox>
   <UniformGrid Grid.Row="2"
                Columns="2">
      <TextBlock Text="OPState"/>
      <TextBlock Text="{Binding SelOPState.Name}"/>
   </UniformGrid>
   <UniformGrid Grid.Row="3"
                Columns="6"
                Visibility="{Binding E80000_Visibility}">
      <TextBlock Text="E80000: "/>
      <TextBlock Text="{Binding sE80000}"
                 HorizontalAlignment="Left"/>
      <TextBlock Text="E80001: "/>
      <TextBlock Text="{Binding sE80001}"
                 HorizontalAlignment="Left"/>
      <TextBlock Text="E80002: "
                 Visibility="{Binding E80002_Visibility}"/>
      <TextBlock Text="{Binding sE80002}"
                 HorizontalAlignment="Left"
                 Visibility="{Binding E80002_Visibility}"/>
   </UniformGrid>
   <Expander  Grid.Row="4"
              Header="Axis">
      <EgtBEAMWALL:AxesPanelV DataContext="{StaticResource AxesPanelVM}"/>
   </Expander>

   
   <Grid Grid.Row="5">
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>
      <StackPanel Grid.Row="0"
               Orientation="Horizontal"
               HorizontalAlignment="Right">
         <Button Command="{Binding MoveUpRawPart_Command}"
                 IsEnabled="{Binding MoveRawPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/MoveUp.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding MoveDownRawPart_Command}"
                 IsEnabled="{Binding MoveRawPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/MoveDown.png" Stretch="Uniform"/>
         </Button>
         <Button ToolTip="{Binding ProduceAll_ToolTip}"
                 Command="{Binding ProduceAll_Command}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/ProduceAll.png" Stretch="Uniform"/>
         </Button>
         <Button ToolTip="{Binding DoneRawPart_ToolTip}"
                 Command="{Binding DoneRawPart_Command}"
                 IsEnabled="{Binding DoneRawPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/DoneRawPart.png" Stretch="Uniform"/>
         </Button>
         <Button ToolTip="{Binding ResetRawPart_ToolTip}"
                 Command="{Binding ResetRawPart_Command}"
                 IsEnabled="{Binding ResetRawPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/ResetRawPart.png" Stretch="Uniform"/>
         </Button>
         <Button ToolTip="{Binding DeleteRawPart_ToolTip}"
                 Command="{Binding DeleteRawPart_Command}"
                 IsEnabled="{Binding DeleteRawPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/DeleteRawPart.png" Stretch="Uniform"/>
         </Button>
      </StackPanel>

      <EgtBEAMWALL:RawPartListV Grid.Row="1"
                                DataContext="{StaticResource RawPartListVM}"
                                Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
   </Grid>

   <GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="6" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"/>

   <Grid Grid.Row="7">
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>
      <StackPanel Grid.Row="0"
               Orientation="Horizontal"
               HorizontalAlignment="Right">
         <Button ToolTip="{Binding PrintLabel_ToolTip}"
                 Command="{Binding PrintLabel_Command}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Visibility="{Binding PrintLabel_Visibility}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/PrintLabel.png" Stretch="Uniform"/>
         </Button>
         <Button ToolTip="{Binding DonePart_ToolTip}"
                 Command="{Binding DonePart_Command}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Visibility="{Binding DonePart_Visibility}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/DonePart.png" Stretch="Uniform"/>
         </Button>
      </StackPanel>

      <Grid Grid.Row="1" x:Name="PartFeatureGrid">
         <Grid.Resources>
            <EgtBEAMWALL:FeatureDataGridHeightConverter x:Key="FeatureDataGridHeightConverter"/>
         </Grid.Resources>
         <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto"/>
         </Grid.RowDefinitions>
         <EgtBEAMWALL:PartInRawPartListV DataContext="{StaticResource PartInRawPartListVM}"
                                      Tag="{Binding Tag.SelectedMachGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
         <EgtBEAMWALL:FeatureInPartInRawPartListV Grid.Row="1" 
                                                  Height="{Binding ActualHeight, ElementName=PartFeatureGrid, Converter={StaticResource FeatureDataGridHeightConverter}}"
                                               DataContext="{StaticResource FeatureInPartInRawPartListVM}"
                                               Tag="{Binding Tag.SelectedMachGroup.SelPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                                               Visibility="{Binding DataContext.FeatureList_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"/>
      </Grid>
   </Grid>

</Grid>
