<Grid x:Class="OnlyProdPDFEditorV"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer">

   <Grid.Resources>
      <EgtBEAMWALL:ColumnNameConverter x:Key="ColumnNameConverter"/>
   </Grid.Resources>
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="Auto"/>
         <ColumnDefinition Width="1*"/>
      </Grid.ColumnDefinitions>
      <GroupBox Header="PDF Preview"
                Style="{StaticResource GroupBox_PDFPreview}"
                Foreground="{StaticResource BeamWall_Corduroy}">
         <StackPanel Style="{StaticResource StackPanel_List}">
            <Button ToolTip="PDF Viewer - Preview"
                    Command="{Binding CreatePreviewVis_Command}"
                    Style="{StaticResource OnlyProdPDFPanel_Button}">
               <Image Source="/Resources/PDFEditor/PrintPDF.png" Stretch="Uniform"/>
            </Button>
            <Button ToolTip="PDF Viewer - Optimizer"
                    Command="{Binding CreatePreviewOtt_Command}"
                    Style="{StaticResource OnlyProdPDFPanel_Button}">
               <Image Source="/Resources/PDFEditor/PrintPDF.png" Stretch="Uniform"/>
            </Button>
            <Button ToolTip="Close PDF Viewer"
                    Command="{Binding ClosePreview_Command}"
                    Style="{StaticResource OnlyProdClose_Button}">
               <Image Source="/Resources/PDFEditor/Delete.png" Stretch="Uniform"/>
            </Button>
         </StackPanel>
      </GroupBox>
      <ScrollViewer Grid.Row="1"
                    Style="{StaticResource OnlyProd_ScrollViewer}">
         <ItemsControl ItemsSource="{Binding ExpanderList}"
                       Style="{StaticResource ItemsControl_ExpanderList}">
            <ItemsControl.ItemsPanel>
               <ItemsPanelTemplate>
                  <StackPanel Style="{StaticResource StackPanel}"/>
               </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
               <DataTemplate>
                  <Expander Style="{StaticResource Expander_PDF}">
                     <Expander.Header>
                        <TextBlock Text="{Binding sNameCategory}"
                                   Style="{StaticResource Category_TextBlock}"
                                   Foreground="{StaticResource BeamWall_White}"/>
                     </Expander.Header>
                     <ItemsControl ItemsSource="{Binding ExpanderElementList}"
                                   Style="{StaticResource ItemsControl_ExpanderElementList}">
                        <ItemsControl.ItemsPanel>
                           <ItemsPanelTemplate>
                              <StackPanel Style="{StaticResource StackPanel}"/>
                           </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.Resources>
                           <DataTemplate DataType="{x:Type EgtBEAMWALL:ExpanderElement}">
                              <StackPanel Style="{StaticResource StackPanel_List}">
                                 <CheckBox IsChecked="{Binding bParameter_IsChecked, UpdateSourceTrigger=PropertyChanged}"
                                           Style="{StaticResource OptionCheckBox}"/>
                                 <TextBlock Text="{Binding sNameParameter}"
                                            Style="{StaticResource OptionTextBlock}"
                                            Foreground="{StaticResource BeamWall_Corduroy}"/>
                              </StackPanel>
                           </DataTemplate>
                           <DataTemplate DataType="{x:Type EgtBEAMWALL:ExpanderTable}">
                              <Grid>
                                 <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="Auto"/>
                                 </Grid.ColumnDefinitions>
                                 <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="1*"/>
                                 </Grid.RowDefinitions>
                                 <ListBox ItemsSource="{Binding RawPartColumns}"
                                          SelectedItem="{Binding SelColumns}"
                                          Style="{StaticResource ListBox_PDF}"
                                          ItemContainerStyle="{StaticResource AlternationIndex_ListBoxItem}">
                                    <ListBox.ItemTemplate>
                                       <DataTemplate>
                                          <StackPanel Style="{StaticResource StackPanel_List}" Margin="0,-0.5,0,5">
                                             <CheckBox IsChecked="{Binding bIsChecked}" 
                                                       Style="{StaticResource OptionCheckBox}"/>
                                             <TextBlock Text="{Binding Name, Converter={StaticResource ColumnNameConverter}}"
                                                        Style="{StaticResource OptionTextBlock}"/>
                                          </StackPanel>
                                       </DataTemplate>
                                    </ListBox.ItemTemplate>
                                 </ListBox>
                                 <UniformGrid Grid.Row="1"
                                              Rows="2"
                                              Visibility="{Binding vRawPartVisibility}">
                                    <StackPanel Style="{StaticResource StackPanel_List}">
                                       <CheckBox IsChecked="{Binding bSection_IsChecked}" 
                                                 Style="{StaticResource OptionCheckBox}"/>
                                       <TextBlock Text="{Binding Section_Msg}"
                                                  Style="{StaticResource OptionTextBlock}"
                                                  Foreground="{StaticResource BeamWall_Corduroy}"/>
                                    </StackPanel>
                                    <StackPanel Style="{StaticResource StackPanel_List}">
                                       <CheckBox IsChecked="{Binding bImage_IsChecked}" 
                                                 Style="{StaticResource OptionCheckBox}"/>
                                       <TextBlock Text="{Binding Image_Msg}"
                                                  Style="{StaticResource OptionTextBlock}"
                                                  Foreground="{StaticResource BeamWall_Corduroy}"/>
                                    </StackPanel>
                                 </UniformGrid>
                                 <StackPanel Grid.Column="1"
                                             Style="{StaticResource StackPanel_Button}">
                                    <Button Command="{Binding MoveUpOrder_Command}"
                                            Style="{StaticResource LeftPanel_Button}">
                                       <Image Source="/Resources/PDFEditor/MoveUp.png" Stretch="Uniform"/>
                                    </Button>
                                    <Button Command="{Binding MoveDownOrder_Command}"
                                            Style="{StaticResource LeftPanel_Button}">
                                       <Image Source="/Resources/PDFEditor/MoveDown.png" Stretch="Uniform"/>
                                    </Button>
                                 </StackPanel>
                              </Grid>
                           </DataTemplate>
                        </ItemsControl.Resources>
                     </ItemsControl>
                  </Expander>
               </DataTemplate>
            </ItemsControl.ItemTemplate>
         </ItemsControl>
      </ScrollViewer>
      <GroupBox Grid.Column="1"
                Grid.RowSpan="2"
                Style="{StaticResource GroupBox_PDFPreview}"
                Foreground="{StaticResource BeamWall_Corduroy}">
         <GroupBox.Header>
            <StackPanel Orientation="Horizontal">
               <Image Source="/Resources/PDFEditor/PDFPreview.png" Height="20" Width="20" Stretch="Uniform"/>
               <TextBlock Text="PDF" Margin="5,2,0,0"/>
            </StackPanel>
         </GroupBox.Header>
         <EgtBEAMWALL:PdfViewer PdfPath="{Binding WebAddress}" Visibility="{Binding PdfViewer_Visibility}"/>
      </GroupBox>
   </Grid>

</Grid>
