[WPF]masquer image d'un GridViewColumn d'un listView
Bonsoir,
je chercher a conditionner l'affichage d'une image selon un Bool contenue dans une de mes classes métiers. J'ai cherche sur internet mais je n'ai pas trouvé comment faire.
voici mon xaml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<Window x:Class="Wpf.GestionTache.MainWindow"
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:Wpf.GestionTache"
mc:Ignorable="d"
Title="MainWindow" Height="237" Width="525" Loaded="Window_Loaded">
<Grid Margin="0,0,0,16">
<Label x:Name="lblName" Content="Gestionnaire de tâches" HorizontalAlignment="Left" Margin="191,10,0,0" VerticalAlignment="Top"/>
<ListView x:Name="lvTaches" HorizontalAlignment="Left" Height="153" VerticalAlignment="Top" Width="334" Margin="10,36,0,0">
<ListView.View>
<GridView>
<GridViewColumn x:Name="gvcTitre" Header="Tâches" DisplayMemberBinding="{Binding titre}"/>
<GridViewColumn x:Name="gvcAlarme" Header="Alarme">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Source="images/reveil.jpg"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button x:Name="btnAjoutTache" Content="Ajoutée une tâche" HorizontalAlignment="Left" VerticalAlignment="Top" Width="158" Margin="349,36,0,0" Height="27" Click="btnAjoutTache_Click"/>
<Button x:Name="btnAffiTache" Content="Affichée la tâche" HorizontalAlignment="Left" Margin="349,68,0,0" VerticalAlignment="Top" Width="158" Click="btnAffiTache_Click"/>
<Button x:Name="btnSupTache" Content="Supprimée la tâche" HorizontalAlignment="Left" Margin="349,93,0,0" VerticalAlignment="Top" Width="158" Click="btnSupTache_Click"/>
</Grid>
</Window> |
après j'ai une classe "tache" avec dedans un attribut de type bool qui détermine si sur ma "tache" je dois mettre une alarme.
Je ne sais pas trop comment faire pour conditions l'affichage de mon image dans le xaml.cs
je vous remercie de votre aide.