Salut
Est-il possible de contrôler comment est affiché le masque de sélection d'une ListBox ? Je m'explique : quand on sélectionne un élément dans une liste, il est mis en valeur par un masque qui modifie les couleurs.
Dans mon appli, j'ai une ListBox avec des datatemplates alternatifs pour les items. Mais quand je sélectionne un élément dans la liste, seul le texte change de couleur, pas le fond (cf. screenshot)... Donc quand je sélectionne un élément avec un texte noir sur fond blanc, le texte devient blanc donc invisible... je voudrais inverser la couleur de fond.
Je ne vois pas trop comment faire, d'où ma question sur le masque de sélection...
Pour info, voici le code XAML des templates :
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36 <DataTemplate x:Key="tmplDVD"> <Border CornerRadius="5" BorderThickness="1" BorderBrush="Blue" Margin="3" Background="White"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="75" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="{Binding Cover}" Width="75" Height="100" Stretch="Uniform" /> <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center"> <TextBlock FontSize="16" FontWeight="Bold" Text="{Binding Title}" /> <TextBlock Text="{Binding Year}" /> <TextBlock Text="{Binding Director.Name}" /> </StackPanel> </Grid> </Border> </DataTemplate> <DataTemplate x:Key="tmplDVDAlt"> <Border CornerRadius="5" BorderThickness="1" BorderBrush="Blue" Margin="3" Background="LightGray"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="75" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="{Binding Cover}" Width="75" Height="100" Stretch="Uniform" /> <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center"> <TextBlock FontSize="16" FontWeight="Bold" Text="{Binding Title}" /> <TextBlock Text="{Binding Year}" /> <TextBlock Text="{Binding Director.Name}" /> </StackPanel> </Grid> </Border> </DataTemplate>
Partager