Hello,
J'ai suivi un tuto qui explique comment faire un style. Donc je l'ai suivi sans problème. Ensuite je me suis dit que j'allais appliqué ce que je venais d'apprendre sur un simple Label.
Voici le code XAML:
Donc jusque là pas de problème mes Label prennent bien le style en question.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <Style TargetType="{x:Type Label}"> <Setter Property="FontFamily" Value="Courier"></Setter> <Setter Property="FontSize" Value="12"></Setter> <Setter Property="Foreground" Value="Black"></Setter> <Setter Property="HorizontalContentAlignment" Value="Center"></Setter> <Setter Property="HorizontalAlignment" Value="Stretch"></Setter> <Setter Property="VerticalAlignment" Value="Stretch"></Setter> </Style>
Ayant appris comment faire pour changer l'état lors d'un MouseOver j'ai tenté de reproduire sur mes Labels avec ce code:
Et là, grosse surprise mon label disparaît de ma form !
Code : 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 <Style TargetType="{x:Type Label}"> <Setter Property="FontFamily" Value="Courier"></Setter> <Setter Property="FontSize" Value="12"></Setter> <Setter Property="Foreground" Value="Black"></Setter> <Setter Property="HorizontalContentAlignment" Value="Center"></Setter> <Setter Property="HorizontalAlignment" Value="Stretch"></Setter> <Setter Property="VerticalAlignment" Value="Stretch"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Label.FontWeight" Value="Bold"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
Donc je ne vois pas......
Partager