Bonjour à tous,

Je rencontre un petit problème. J'ai une combobox dont le style prend celui des textblock.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
        <ComboBox Grid.Column="2" Grid.Row="3" Name="cb_niveau" Margin="5,0,0,5" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="340">
            <ComboBoxItem Content="un"/>
            <ComboBoxItem Content="deux"/>
            <ComboBoxItem Content="trois"/>
            <ComboBoxItem Content="quatre"/>
            <ComboBoxItem Content="cinq"/>
        </ComboBox>
Le style :

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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <!--Feuille de style de l'application-->
        <Style TargetType="ComboBoxItem">
            <Setter Property="FontSize" Value="10"/>
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="HorizontalAlignment" Value="Center" />
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="HorizontalAlignment" Value="Center" />
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="FontFamily" Value="Segoe Print"/>
            <Setter Property="FontSize" Value="20"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="TextDecorations" Value="underline"/>
            <Setter Property="Foreground" Value="Black"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="FontSize" Value="20"/>
            <Setter Property="FontWeight" Value="Bold"/>
        </Style>
        <Style TargetType="StackPanel">
            <Setter Property="OpacityMask" Value="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}"/>
            <Setter Property="Background" Value="White"/>
        </Style>
        <Style TargetType="Grid">
            <Setter Property="Background" Value="#FFD6F1F9"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="FontSize" Value="20"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Margin" Value="5"/>
        </Style>
    </Application.Resources>
</Application>
Voila donc, la combobox prend le style appliqué au textblock et non celui appliqué à la combobox.

Quelqu'un à une idée ?

merci bien