<EgtWPFLib5:EgtCustomWindow x:Class="OnlyProdNewOpenProjectFileDialogV"
                            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.Core"
                            Title="{Binding Title}"
                            Style="{StaticResource OnlyProd_EgtCustomWindow}"
                            WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
                            IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
                            IsClosable="False"
                            MinHeight="500" MinWidth="500"
                            DataContext="{Binding RelativeSource={RelativeSource Self}}">

   <EgtWPFLib5:EgtCustomWindow.Resources>
      <EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
   </EgtWPFLib5:EgtCustomWindow.Resources>

   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto"/>
         <RowDefinition Height="5*"/>
         <RowDefinition Height="1*"/>
      </Grid.RowDefinitions>

      <GroupBox Header="{Binding Filters_Msg}"
                Visibility="{Binding Filters_Visibility}"
                Margin="5">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid>
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <ComboBox ItemsSource="{Binding BTLDateTypeList}"
                         SelectedIndex="{Binding SelBTLDateType}"
                         Style="{StaticResource BTLDateTypeList_ComboBox}"/>
               <StackPanel Grid.Column="1" 
                           Orientation="Horizontal">
                  <ComboBox ItemsSource="{Binding DayTypeList}"
                            SelectedIndex="{Binding SelDayType}"
                            Style="{StaticResource DayTypeList_ComboBox}"/>
                  <StackPanel Orientation="Horizontal" 
                              Visibility="{Binding Date_Visibility}">
                     <TextBlock Text="{Binding From_Msg}"
                                Style="{StaticResource Filter_TextBlock}"
                                Foreground="{StaticResource BeamWall_Corduroy}"/>
                     <DatePicker SelectedDate="{Binding dtStartDate}"
                                 Style="{StaticResource Filter_DatePicker}"
                                 CalendarStyle="{StaticResource Filter_Calendar}"/>
                     <TextBlock Text="{Binding To_Msg}"
                                Style="{StaticResource Filter_TextBlock}"
                                Foreground="{StaticResource BeamWall_Corduroy}"/>
                     <DatePicker SelectedDate="{Binding dtEndDate}"
                                 Style="{StaticResource Filter_DatePicker}"
                                 CalendarStyle="{StaticResource Filter_Calendar}"/>
                  </StackPanel>
               </StackPanel>
               <CheckBox Grid.Column="2"
                         IsChecked="{Binding bViewArchived}"
                         Content="{Binding ViewArchived_Msg}"
                         VerticalAlignment="Center"/>
            </Grid>
            <Grid Grid.Row="1">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="1*"/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <ComboBox ItemsSource="{Binding FilterTypeList}"
                         SelectedItem="{Binding SelFilterType}"
                         Width="105"
                         Margin="5"
                         Style="{StaticResource OnlyProdCalcPanel_ComboBox}"/>
               <EgtWPFLib5:EgtTextBox Grid.Column="1"
                                      Text="{Binding SearchText}"
                                      Visibility="{Binding SearchText_Visibility}"
                                      Style="{StaticResource NewSearchText_TextBox}"/>
               <StackPanel Grid.Column="2" 
                           Orientation="Horizontal">
                  <TextBlock Text="{Binding Rows_Msg}"
                             Style="{StaticResource OptionTextBlock}"
                             Foreground="{StaticResource BeamWall_Corduroy}"/>
                  <ComboBox ItemsSource="{Binding RowQuantityList}"
                            SelectedIndex="{Binding SelRowQuantity}"
                            Style="{StaticResource OnyProd_FeatureComboBox}"/>
               </StackPanel>
            </Grid>
         </Grid>
      </GroupBox>

      <Border Grid.Row="1" Style="{StaticResource OnlyProdPage_Border}" Margin="1"/>

      <EgtBEAMWALL:EgtDataGrid Grid.Row="1"
                               x:Name="MainDataGrid"
                               ItemsSource="{Binding ProjectList}" 
                               SelectedItem="{Binding SelProject}"
                               SelectionMode="Single"
                               Margin="5"
                               BindingColumns="{Binding ProdColumns}"
                               RowDetailsVisibilityMode="Visible"
                               CellEditEnding="MainDataGrid_CellEditEnding"
                               AlternatingRowBackground="{StaticResource BeamWall_LinkWater}"
                               AlternationCount="2"
                               ColumnHeaderBackground="{StaticResource BeamWall_Teal}"
                               ColumnHeaderForeground="{StaticResource BeamWall_White}"
                               ColumnHeaderHorizontalContentAlignment="Center"
                               ColumnHeaderFontWeight="Bold"
                               ColumnHeaderFontSize="15"
                               ColumnHeaderPadding="0,2,0,2"
                               Style="{StaticResource DataGrid_OnlyProd}"
                               CellStyle="{StaticResource CellDataGrid_CustomHighLight}">
         <DataGrid.Resources>
            <!-- ProdId -->
            <DataGridTextColumn x:Key="colPRODID" Binding="{Binding sProdId}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--Name-->
            <DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
               <DataGridTextColumn.Header>
                  <Grid>
                     <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="Auto"/>
                     </Grid.ColumnDefinitions>
                     <TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
                     <ToggleButton Grid.Column="1"
                                   IsChecked="{Binding Path=DataContext.bIsEditNameActive,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"
                                   Style="{StaticResource ToolBar_SmallToggleButton}">
                        <Image Source="\Resources\CalcPanel\Edit.png"
                               Style="{StaticResource LockImage}"/>
                     </ToggleButton>
                  </Grid>
               </DataGridTextColumn.Header>
            </DataGridTextColumn>
            <!-- Creation date -->
            <DataGridTextColumn x:Key="colCRTDATE" Binding="{Binding dtCreateDate}">
               <DataGridTextColumn.Header>
                  <TextBlock Text="{Binding Path=DataContext.CreateDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
               </DataGridTextColumn.Header>
            </DataGridTextColumn>
            <!-- Machine -->
            <DataGridTextColumn x:Key="colMACHINE" Binding="{Binding sMachine}">
               <DataGridTextColumn.Header>
                  <TextBlock Text="{Binding Path=DataContext.Machine_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
               </DataGridTextColumn.Header>
            </DataGridTextColumn>
            <!-- Archived -->
            <DataGridTemplateColumn x:Key="colARCHIVED">
               <DataGridTemplateColumn.CellTemplate>
                  <DataTemplate>
                     <Image Source="\Resources\OpenProjectFileDialog\Archived.png"
                            Visibility="{Binding Archived_Visibility}"
                            Style="{StaticResource Archived_Image}"/>
                  </DataTemplate>
               </DataGridTemplateColumn.CellTemplate>
               <DataGridTemplateColumn.Header>
                  <TextBlock Text="{Binding Path=DataContext.Archived_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
               </DataGridTemplateColumn.Header>
            </DataGridTemplateColumn>
         </DataGrid.Resources>
         <DataGrid.RowStyle>
            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
               <Setter Property="FontWeight" Value="DemiBold"/>
               <Setter Property="VerticalContentAlignment" Value="Center"/>
               <EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
            </Style>
         </DataGrid.RowStyle>
         <DataGrid.RowDetailsTemplate>
            <DataTemplate>
               <ItemsControl ItemsSource="{Binding ProjFileList}"
                             Style="{StaticResource ProjFileList_ItemsControl}">
                  <ItemsControl.ItemTemplate>
                     <DataTemplate>
                        <Grid Style="{StaticResource ProjFileList_Grid}">
                           <Grid.ColumnDefinitions>
                              <ColumnDefinition Width="{Binding Path=DataContext.ProdColumns[0].ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"/>
                              <ColumnDefinition Width="1*"/>
                           </Grid.ColumnDefinitions>
                           <Grid.RowDefinitions>
                              <RowDefinition Height="1"/>
                              <RowDefinition Height="1*"/>
                           </Grid.RowDefinitions>
                           <Grid Grid.Row="0"
                                 Grid.ColumnSpan="2"
                                 Style="{StaticResource Gray_Grid}"/>
                           <Grid Grid.Column="1"
                                 Grid.Row="1"
                                 Margin="2">
                              <Grid.ColumnDefinitions>
                                 <ColumnDefinition Width="Auto"/>
                                 <ColumnDefinition Width="1*"/>
                                 <ColumnDefinition Width="Auto"/>
                                 <ColumnDefinition Width="1*"/>
                              </Grid.ColumnDefinitions>
                              <Grid.RowDefinitions>
                                 <RowDefinition Height="1*"/>
                                 <RowDefinition Height="1*"/>
                              </Grid.RowDefinitions>
                              <TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"
                                         Style="{StaticResource OpenWnd_TextBlock}"/>
                              <TextBlock Grid.Column="1"
                                         Text="{Binding sBTLFileName}"/>
                              <TextBlock Grid.Row="1"
                                         Text="{Binding Path=DataContext.ListName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"
                                         Style="{StaticResource OpenWnd_TextBlock}"/>
                              <TextBlock Grid.Column="1"
                                         Grid.Row="1"
                                         Text="{Binding sListName}"/>
                              <TextBlock Grid.Column="2"
                                         Text="{Binding Path=DataContext.ExportDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdNewOpenProjectFileDialogV}}}"
                                         Style="{StaticResource OpenWnd_TextBlock}"/>
                              <TextBlock Grid.Column="3"
                                         Text="{Binding dtExportDate}"/>
                           </Grid>
                        </Grid>
                     </DataTemplate>
                  </ItemsControl.ItemTemplate>
               </ItemsControl>
            </DataTemplate>
         </DataGrid.RowDetailsTemplate>
      </EgtBEAMWALL:EgtDataGrid>

      <UniformGrid Columns="4" Grid.Row="2" 
                   Margin="0,0,0,5">
         <Button IsDefault="True" Name="OpenBtn"
                 Content="{Binding Open_Msg}" 
                 Style="{DynamicResource OnlyProdEgtWPFLib5_InputButton}"/>
         <Button Content="{Binding Archive_Msg}"
                 Command="{Binding Archive_Command}"
                 IsEnabled="{Binding bArchived_IsEnabled}"
                 Style="{DynamicResource OnlyProdEgtWPFLib5_InputButton}"/>
         <Button Content="{Binding Delete_Msg}"
                 Command="{Binding Delete_Command}"
                 IsEnabled="{Binding bDelete_IsEnabled}"
                 Style="{DynamicResource OnlyProdEgtWPFLib5_InputButton}"/>
         <Button Command="{Binding Cancel_Command}"
                 Content="{Binding Cancel_Msg}" 
                 Style="{DynamicResource OnlyProdEgtWPFLib5_InputButton}"/>
      </UniformGrid>

   </Grid>

</EgtWPFLib5:EgtCustomWindow>
