<UserControl x:Class="MachineLogPageV"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
             xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>

      <Grid Visibility="Collapsed">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
         </Grid.ColumnDefinitions>
         <!--<ComboBox ItemsSource="MachLogTypeList"
                   SelectedItem="SelMachLogType"/>-->
         <Button Grid.Column="1"
                 Command="{Binding Refresh_Command}"
                 Margin="2.5,0,5,0"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/MDIPage/Send.png" Stretch="Uniform"/>
         </Button>
      </Grid>

      <StackPanel Orientation="Horizontal" Height="30">
         <TextBlock Text="{Binding Entity_Msg}"
                    Style="{StaticResource Log_TextBlock}"/>
         <ComboBox ItemsSource="{Binding EntityTypeList}"
                   SelectedIndex="{Binding SelEntityType}"
                   Width="70"
                   Margin="0,0,2.5,0"
                   Style="{StaticResource PartParam_ComboBox}"/>
         <TextBlock Text="{Binding Event_Msg}"
                    Style="{StaticResource Log_TextBlock}"/>
         <ComboBox ItemsSource="{Binding PartEventTypeList}"
                   SelectedIndex="{Binding SelPartEventType}"
                   Width="70"
                   Margin="0,0,2.5,0"
                   Style="{StaticResource PartParam_ComboBox}"/>
         <TextBlock Text="{Binding Date_Msg}"
                    Style="{StaticResource Log_TextBlock}"/>
         <ComboBox ItemsSource="{Binding DayTypeList}"
                   SelectedIndex="{Binding SelDayType}"
                   Width="70"
                   Margin="0,0,2.5,0"
                   Style="{StaticResource PartParam_ComboBox}"/>
         <StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
            <TextBlock Text="{Binding From_Msg}"
                       Style="{StaticResource Log_TextBlock}"/>
            <DatePicker SelectedDate="{Binding dtStartDate}"
                        Style="{StaticResource Log_DatePicker}"/>
            <TextBlock Text="{Binding To_Msg}"
                       Style="{StaticResource Log_TextBlock}"/>
            <DatePicker SelectedDate="{Binding dtEndDate}"
                        Style="{StaticResource Log_DatePicker}"/>
         </StackPanel>
         <!--<TextBox Text="{Binding MaxRowNumber}"/>-->
         <Button Grid.Column="1"
                 Command="{Binding Refresh_Command}"
                 Margin="2.5,0,5,0"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/MDIPage/Send.png" Stretch="Uniform"/>
         </Button>
      </StackPanel>

      <EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding MachineLogList}"
                                   Grid.Row="1"
                                   AutoGenerateColumns="False"
                                   CanUserDeleteRows="False"
                                   CanUserResizeRows="False"
                                   SelectionMode="Single"
                                   ScrollViewer.CanContentScroll="True" 
                                   ScrollViewer.VerticalScrollBarVisibility="Auto"
                                   ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                   Margin="0,0,0,5"
                                   BindingColumns="{Binding MachineLogColumns}">
         <DataGrid.Resources>
            <!-- Data/ora -->
            <DataGridTextColumn x:Key="colDATETIME" Binding="{Binding sEventDateTime}"
                                SortMemberPath="sEventTick">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.EventDateTime_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!-- Type -->
            <DataGridTextColumn x:Key="colTYPE" Binding="{Binding sEventType}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.EventType_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!-- Descrizione -->
            <DataGridTextColumn x:Key="colDESCRIPTION" Binding="{Binding sEventValue}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.EventValue_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!-- SupervisorId -->
            <DataGridTextColumn x:Key="colSUPERVISORID" Binding="{Binding SupervisorId}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.SupervisorId_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <DataGridTextColumn x:Key="colPROD" Binding="{Binding ProdId}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.ProdId_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <DataGridTextColumn x:Key="colMACHGROUP" Binding="{Binding MachGroupId}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.MachGroupId_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <DataGridTextColumn x:Key="colPART" Binding="{Binding PartId}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.PartId_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <DataGridTextColumn x:Key="colSTATUS" Binding="{Binding Status}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.Status_Msg,
                                            RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:MachineLogPageV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
         </DataGrid.Resources>

      </EgtBEAMWALLCORE:EgtDataGrid>

   </Grid>

</UserControl>
