<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.ViewerOptimizer">

   <Grid.RowDefinitions>
      <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 SearchFilter_Msg}"
             IsEnabled="{Binding SearchFilter_IsEnabled}"
             Margin="3,1,3,3">
      <Expander>
         <Expander.Header>
            <Grid HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="1*" x:Name="ComboColumn"/>
               </Grid.ColumnDefinitions>
               <TextBlock Text="{Binding Section_Msg}"
                          VerticalAlignment="Center"/>
               <ComboBox ItemsSource="{Binding Tag.SectionList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                         SelectedItem="{Binding Tag.SelSection, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                         DisplayMemberPath="sSectionXMaterial"
                         Grid.Column="1"/>
            </Grid>
         </Expander.Header>
         <Grid Margin="1,0,1,0">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="24"/>
               <ColumnDefinition Width="1*"/>
               <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Group_Msg}"
                       Grid.ColumnSpan="2"
                       VerticalAlignment="Center"/>
            <ComboBox ItemsSource="{Binding Tag.GroupList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      SelectedItem="{Binding Tag.SelGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      Grid.Column="2"
                      Margin="0,2,0,2"/>
            <TextBlock Text="{Binding SubGroup_Msg}"
                       Grid.Row="1"
                       Grid.ColumnSpan="2"
                       VerticalAlignment="Center"/>
            <ComboBox ItemsSource="{Binding Tag.SubGroupList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      SelectedItem="{Binding Tag.SelSubGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      Grid.Column="2"
                      Grid.Row="1"
                      Margin="0,2,0,2"/>
            <TextBlock Text="{Binding ParType_Msg}"
                       Grid.Row="2"
                       Grid.ColumnSpan="2"
                       VerticalAlignment="Center"/>
            <ComboBox ItemsSource="{Binding Tag.SearchParamList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      SelectedItem="{Binding Tag.SelSearchParam, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                      Grid.Column="2"
                      Grid.Row="2"
                      Margin="0,2,0,2"/>
            <TextBlock Text="{Binding ParValue_Msg}"
                       Grid.Row="3"
                       Grid.ColumnSpan="2"
                       VerticalAlignment="Center"/>
            <EgtWPFLib5:EgtTextBox Text="{Binding Tag.SearchText, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                                   Grid.Column="2"
                                   Grid.Row="3"
                                   Margin="0,2,0,0"/>
         </Grid>
      </Expander>
   </GroupBox>
   <Grid Grid.Row="1">
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>
      <StackPanel Orientation="Horizontal"
                  HorizontalAlignment="Right">
         <Button Command="{Binding NewRawPart_Command}"
                 Visibility="{Binding MachiningPage_Visibility}"
                 ToolTip="{Binding NewRawPart_ToolTip}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/NewRawPart.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding NewRawPartLast_Command}"
                 Visibility="{Binding MachiningPage_Visibility}"
                 ToolTip="{Binding NewRawPartLast_ToolTip}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/NewRawPartAuto.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding AddToRawPart_Command}"
                 Visibility="{Binding MachiningPage_Visibility}"
                 ToolTip="{Binding AddToRawPart_ToolTip}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/AddToRawPart.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding CopyPart_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding CopyPart_ToolTip}"
                 IsEnabled="{Binding CopyPart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/CopyPart.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding AddPart_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding AddPart_ToolTip}"
                 IsEnabled="{Binding LeftPanel_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/AddPart.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding RemovePart_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding RemovePart_ToolTip}"
                 IsEnabled="{Binding RemovePart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/RemovePart.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding Invert_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding Invert_ToolTip}"
                 IsEnabled="{Binding RotatePart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/PartManager/LeftInvert.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding Invert_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding Invert_ToolTip}"
                 IsEnabled="{Binding RotatePart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/PartManager/RightInvert.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding BackRotation_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding BackRotation_ToolTip}"
                 IsEnabled="{Binding RotatePart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/PartManager/LeftRotate.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding ForwardRotation_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding ForwardRotation_ToolTip}"
                 IsEnabled="{Binding RotatePart_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/PartManager/RightRotate.png" Stretch="Uniform"/>
         </Button>
      </StackPanel>
      <EgtBEAMWALL:BTLPartListV DataContext="{StaticResource PartListVM}"
                             Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                             Grid.Row="1"/>
   </Grid>
   <GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="2"/>
   <Grid Grid.Row="3">
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>
      <StackPanel Orientation="Horizontal"
                  HorizontalAlignment="Right">
         <Button Command="{Binding CopyFeature_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding CopyFeature_ToolTip}"
                 IsEnabled="{Binding CopyFeature_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/CopyFeature.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding MacroFeature_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding MacroFeature_ToolTip}"
                 IsEnabled="{Binding MacroFeature_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/MacroFeature.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding AddFeature_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding AddFeature_ToolTip}"
                 IsEnabled="{Binding AddFeature_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/AddFeature.png" Stretch="Uniform"/>
         </Button>
         <Button Command="{Binding RemoveFeature_Command}"
                 Visibility="{Binding ViewPage_Visibility}"
                 ToolTip="{Binding RemoveFeature_ToolTip}"
                 IsEnabled="{Binding RemoveFeature_IsEnabled}"
                 Style="{StaticResource LeftPanel_Button}">
            <Image Source="/Resources/LeftPanel/RemoveFeature.png" Stretch="Uniform"/>
         </Button>
      </StackPanel>
      <EgtBEAMWALL:FeatureListV DataContext="{ StaticResource FeatureListVM}"
                                Tag="{Binding Tag.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LeftPanelV}}}"
                                Grid.Row="1"/>
   </Grid>

</Grid>
