<Window x:Class="ReAct_PME.RechercheCV"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ReAct_PME"
        mc:Ignorable="d"
        Title="Recherche CV" Height="600" Width="800" MinHeight="600" MinWidth="800"  Background="#FFF0F0F0">
    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="10"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Margin" Value="0"/>
        </Style>
        <!-- Style pour changer la couleur des en-têtes -->
        <Style x:Key="DefaultColumnHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Background" Value="LightGray" />
            <Setter Property="Foreground" Value="Black" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
        </Style>
        <!-- Style pour la colonne cliquée -->
        <Style x:Key="ClickedColumnHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Background" Value="LightBlue" />
            <Setter Property="Foreground" Value="Black" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
        </Style>
        <local:NullToBoolConverter x:Key="NullToBoolConverter"/>
        <DropShadowEffect x:Key="ShadowEffect"
                  BlurRadius="8"
                  ShadowDepth="2"
                  Opacity="0.4"
                  Direction="270"/>
    </Window.Resources>

    <Grid>
        <Popup x:Name="ToastPopup"
               Placement="Bottom"
               PlacementTarget="{Binding ElementName=MainGrid}" 
               StaysOpen="False"
               AllowsTransparency="True"
               PopupAnimation="Fade"
               HorizontalOffset="0"
               VerticalOffset="-30">

            <Border Background="#FF323232"
                    CornerRadius="8"
                    Padding="16"
                    Margin="10"
                    Effect="{DynamicResource ShadowEffect}">
                <TextBlock x:Name="ToastMessage"
                           Foreground="White"
                           FontWeight="Bold"
                           FontSize="14"
                           TextWrapping="Wrap"
                           MaxWidth="300"/>
            </Border>
        </Popup>

        <TextBlock Text="Fichier Fiche Mission :" FontWeight="Bold" Margin="10,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="115" Height="24"/>
        <TextBox x:Name="FicheMissionBox"  Text="{Binding FicheMission, Mode=TwoWay}" TextWrapping="Wrap" AcceptsReturn="True" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Margin="120,0,140,0" Height="24"/>
        <Button x:Name="BtnChangeFile" Content="..." Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,0,100,0" VerticalAlignment="Top" Height="25" Width="30" Click="BtnChangeFile_Click" ToolTip="Changer de fiche de mission" />

        <TextBlock Text="Dossier CV :" FontWeight="Bold" Margin="10,34,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="115" Height="24"/>
        <TextBox x:Name="DossierCVBox"  Text="{Binding PathCV, Mode=TwoWay}" TextWrapping="Wrap" AcceptsReturn="True" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Margin="120,30,140,0" Height="24"/>
        <Button x:Name="BtnChangeDirectory" Content="..." Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,30,100,0" VerticalAlignment="Top" Height="25" Width="30" Click="BtnChangeDirectory_Click" ToolTip="Changer de dossier" />
        
        <Button x:Name="BtnRecherche" Content="Recherche" Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,0,10,0" VerticalAlignment="Top" Height="35" Width="74" Click="BtnSearch_Click"/>
        <CheckBox Content="XML ?" IsChecked="{Binding IsGenererXML, Mode=TwoWay}" HorizontalAlignment="Right" Margin="0,40,30,0" VerticalAlignment="Top" ToolTip="Permet d'extraire le CV au format XML (utile pour retravailler le CV sous une autre trame)"/>
        
        <ListView Name="ItemsGrid"
                  AlternationCount="2" Style="{DynamicResource ListViewStyle}" ItemContainerStyle="{DynamicResource AlternatingListViewItemStyle}"
                  IsSynchronizedWithCurrentItem="false" local:GridViewSort.AutoSort="True"
                  ItemsSource="{Binding ListeItems}" SelectedItem="{Binding SelectedItem}" Margin="5,68,5,70">
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="610" local:GridViewSort.PropertyName="FichierCV">
                        <GridViewColumnHeader Content="Fichier CV" Click="ColumnHeader_Click" Style="{DynamicResource DefaultColumnHeaderStyle}"/>
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding FichierCV}" 
                                       TextTrimming="CharacterEllipsis" 
                                       VerticalAlignment="Center" 
                                       FontSize="10"
                                       Padding="0" ToolTip="{Binding Avis}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    
                    <GridViewColumn Width="75" local:GridViewSort.PropertyName="Note">
                        <GridViewColumnHeader Content="Note" Click="ColumnHeader_Click" Style="{DynamicResource DefaultColumnHeaderStyle}"/>
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Note}" 
                                       TextTrimming="CharacterEllipsis" 
                                       VerticalAlignment="Center" 
                                       FontSize="10"
                                       Padding="0" ToolTip="{Binding Avis}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>

                    <GridViewColumn Width="80" local:GridViewSort.PropertyName="PresenceSuspecte_STR">
                        <GridViewColumnHeader Content="Suspect ?" Click="ColumnHeader_Click" Style="{DynamicResource DefaultColumnHeaderStyle}"/>
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding PresenceSuspecte_STR}" 
                                        FontSize="12"
                                        Padding="0"
                                        HorizontalAlignment="Center" 
                                        VerticalAlignment="Center"
                                        ToolTip="{Binding Avis}"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        
        <Button x:Name="BtnDetail" Content="Détail" Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,0,5,35" VerticalAlignment="Bottom" Height="29" Width="74" Click="BtnDetail_Click" />
        <Button Content="Fermer" Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,0,163,35" VerticalAlignment="Bottom" Height="29" Width="74" Click="BtnFermer_Click" />
        <TextBlock x:Name="TxtMessage" Text="..." FontWeight="Bold" Margin="10,0,0,35" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="479" Height="24"/>
        <Button x:Name="BtnOpenCV" Content="Ouvrir CV" Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Right" Margin="0,0,84,35" VerticalAlignment="Bottom" Height="29" Width="74" Click="BtnOpenCV_Click" />

        <TextBox Text="{Binding RechercheString}" HorizontalAlignment="Left" Margin="5,0,15,5" VerticalAlignment="Bottom" Height="29" Width="390" />
        <Button Content="Recherche" Style="{DynamicResource ButtonStyle}"  HorizontalAlignment="Left" Margin="400,0,15,5" VerticalAlignment="Bottom" Height="29" Width="74" Click="BtnRechercheMotClef_Click" />

    </Grid>
</Window>
