<UserControl x:Class="PParameterListV"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer" 
             xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">

   <EgtBEAMWALLCORE:EgtDataGrid AutoGenerateColumns="False"
                                CanUserDeleteRows="False"
                                CanUserResizeRows="False"
                                SelectionMode="Single"
                                ScrollViewer.CanContentScroll="True" 
                                ScrollViewer.VerticalScrollBarVisibility="Auto"
                                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                Margin="0,0,0,5"
                                ItemsSource="{Binding Tag.PBTLParamVMList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PParameterListV}}}"
                                SelectedItem="{Binding Tag.SelPBTLParam, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PParameterListV}}}"
                                IsEnabled="{Binding PParameterList_IsEnabled}"    
                                BindingColumns="{Binding PParameterListColumns}"
                                Style="{StaticResource DataGrid_CustomHighLight}">
      <DataGrid.RowStyle>
         <Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
            <EventSetter Event="PreviewMouseDown" Handler="PParameterList_PreviewMouseDown"/>
         </Style>
      </DataGrid.RowStyle>
      <DataGrid.Resources>
         <EgtBEAMWALL:TrimmedTextBlockVisibilityConverter x:Key="TrimToVisConverter" />
         <!--Custom-->
         <DataGridTemplateColumn x:Key="colCUSTOM">
            <DataGridTemplateColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding DataContext.Custom_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTemplateColumn.HeaderTemplate>
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <CheckBox IsChecked="{Binding bCustom, UpdateSourceTrigger=PropertyChanged}"
                         Visibility="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                         HorizontalAlignment="Center"/>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--Nome-->
         <DataGridTextColumn x:Key="colNAME"  Binding="{Binding sName}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.NAM_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <!--Descrizione-->
         <DataGridTextColumn x:Key="colDESC" Binding="{Binding sDescription}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Description_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
            <DataGridTextColumn.CellStyle>
               <Style TargetType="{x:Type DataGridCell}">
                  <Setter Property="Template">
                     <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridCell}">
                           <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"
                                      TextTrimming="CharacterEllipsis"
                                      Margin="4,0,0,0">
                              <TextBlock.ToolTip>
                                 <ToolTip Visibility="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget, Converter={StaticResource TrimToVisConverter}}">
                                    <ToolTip.Content>
                                       <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"/>
                                    </ToolTip.Content>
                                 </ToolTip>
                              </TextBlock.ToolTip>
                           </TextBlock>
                        </ControlTemplate>
                     </Setter.Value>
                  </Setter>
                  <Style.Triggers>
                     <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Foreground" Value="Blue"/>
                     </Trigger>
                  </Style.Triggers>
               </Style>
            </DataGridTextColumn.CellStyle>
            <DataGridTextColumn.EditingElementStyle>
               <Style TargetType="{x:Type TextBox}">
                  <Setter Property="Foreground" Value="Blue" />
               </Style>
            </DataGridTextColumn.EditingElementStyle>
         </DataGridTextColumn>
         <!--Valore-->
         <DataGridTextColumn x:Key="colVALUE" Binding="{Binding sValue}" SortMemberPath="dValue">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Value_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
            <DataGridTextColumn.EditingElementStyle>
               <Style TargetType="{x:Type TextBox}">
                  <Setter Property="Foreground" Value="Blue" />
               </Style>
            </DataGridTextColumn.EditingElementStyle>
         </DataGridTextColumn>
         <!--Minimo-->
         <DataGridTextColumn x:Key="colMIN" Binding="{Binding sMin}" SortMemberPath="dMin">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Min_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <!--Massimo-->
         <DataGridTextColumn x:Key="colMAX" Binding="{Binding sMax}" SortMemberPath="dMax">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Max_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <!--Default-->
         <!--
         <DataGridTextColumn Binding="{Binding dDefault}"
                              IsReadOnly="True">
            <DataGridTextColumn.Header>
               <TextBlock Text="Name"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>-->
      </DataGrid.Resources>

      <!--</DataGrid>-->

   </EgtBEAMWALLCORE:EgtDataGrid>

</UserControl>
