<UserControl x:Class="FeatureListV"
             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 ItemsSource="{Binding Tag.BTLFeatureVMList,
                                                      RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:FeatureListV}}}"
                                SelectedItem="{Binding Tag.SelBTLFeatureVM,
                                                       RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:FeatureListV}}}"
                                CanUserAddRows="False"
                                AutoGenerateColumns="False"
                                CanUserResizeRows="False"
                                SelectionMode="Single"
                                ScrollViewer.CanContentScroll="True" 
                                ScrollViewer.VerticalScrollBarVisibility="Auto"
                                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                Margin="0,0,0,5"
                                IsEnabled="{Binding FeatureList_IsEnabled}"
                                BindingColumns="{Binding FeatureColumns}"
                                Style="{StaticResource DataGrid_CustomHighLight}">
      <DataGrid.Resources>
         <!--DO - Abilitazione-->
         <DataGridCheckBoxColumn x:Key="colDO" Binding="{Binding bDO, UpdateSourceTrigger=PropertyChanged}"
                                 MinWidth="28">
            <DataGridCheckBoxColumn.Header>
               <CheckBox IsChecked="{Binding Path=Tag.bDOALL, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:FeatureListV}}}"/>
            </DataGridCheckBoxColumn.Header>
         </DataGridCheckBoxColumn>
         <!--Validità feature-->
         <DataGridTemplateColumn x:Key="colCALC">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Grid>
                     <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="10"/>
                     </Grid.ColumnDefinitions>
                     <Border Width="{Binding ActualHeight, RelativeSource={RelativeSource self}}"
                             Background="{Binding Calc_Background}"/>
                     <!--Width="{Binding ActualHeigth, Source=Self}"/>-->
                     <Grid Grid.Column="1"
                           HorizontalAlignment="Center">
                        <Grid.RowDefinitions>
                           <RowDefinition Height="1*"/>
                           <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Ellipse Width="5"
                                 Height="5"
                                 Fill="Red"
                                 Visibility="{Binding CALC_ROT_Visibility}"
                                 HorizontalAlignment="Center"/>
                        <TextBlock Grid.Row="1"
                                   Text="{Binding CALC_ERR_Letter}"
                                   Foreground="{Binding CALC_ERR_Foreground}"
                                   TextAlignment="Center"
                                   FontWeight="Bold"
                                   FontSize="12"
                                   Margin="0,-6,0,-2"/>
                        <!--<Ellipse Width="5"
                                 Height="5"
                                 Fill="Red"
                                 Visibility="{Binding CALC_ROT_Visibility}"/>
                        <TextBlock Text="{Binding CALC_ERR_Letter}"
                                   Foreground="{Binding CALC_ERR_Foreground}"
                                   FontWeight="Bold"
                                   FontSize="10"/>-->
                        <!--<TextBlock Text="&#x2794;"
                                   Visibility="{Binding CALC_FALL_Visibility}"/>-->
                     </Grid>
                  </Grid>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--Descrizione-->
         <DataGridTextColumn x:Key="colDESC" Binding="{Binding sDesc}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.Description_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:FeatureListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!-- Menu' tasto destro -->
         <ContextMenu x:Key="RowMenu" ItemsSource="{Binding MenuList}" >
            <ContextMenu.ItemContainerStyle>
               <Style TargetType="MenuItem">
                  <Setter Property="Command" Value="{Binding MenuItem_Command}"/>
                  <Setter Property="Header" Value="{Binding sMsg}"/>
               </Style>
            </ContextMenu.ItemContainerStyle>
         </ContextMenu>
      </DataGrid.Resources>
      <DataGrid.InputBindings>
         <KeyBinding Key="Delete" Command="{Binding Tag.SelBTLFeatureVM.DeleteFeature_Command,
                                                    RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:FeatureListV}}}" />
      </DataGrid.InputBindings>
      <DataGrid.RowStyle>
         <Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
            <Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
            <EventSetter Event="PreviewMouseDown" Handler="FeatureList_PreviewMouseDown"/>
         </Style>
      </DataGrid.RowStyle>

   </EgtBEAMWALLCORE:EgtDataGrid>
   
</UserControl>
