Bonjour à tous,

Je galère à mettre un style pour les en-tête de colonnes d'un Datagrid, j'aimerais que chaque en-tête soit un rectangle avec bords arrondis.

Pour l'instant j'arrive à avoir mes 3 rectangles correspondant aux 3 colonnes mais on dirait qu'il dessine un autre rectangle qui englobe les trois colonnes ce qui fait qu'entre chaque rectangle j'ai la couleur du fond du rectangle (gris) et non du grid (noire).

Je voulais obtenir plus ou moins ce résultat :
http://www.componentone.com/newimage...d_Carousel.png

Voilà pour l'instant mon 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
        <Style TargetType="DataGridColumnHeader" x:Key="styleHeader" >
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Height" Value="25"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="DataGridColumnHeader">
                        <Grid Name="Root">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
 
                            <Rectangle x:Name="BackgroundRectangle" 
                                       Stretch="Fill" 
                                       Fill="#818181" 
                                       Grid.ColumnSpan="2" 
                                       RadiusX="5" 
                                       RadiusY="5" 
                                       Stroke="Black"
                                       StrokeThickness="1"/>
                            <ContentPresenter x:Name="HeaderText" 
                                  Grid.RowSpan="2" 
                                  Content="{TemplateBinding Content}" 
                                  Cursor="{TemplateBinding Cursor}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                  Margin="5,0,0,0" />
                            <Rectangle Name="VerticalSeparator" 
                               Grid.Column="2" 
                               Width="1" VerticalAlignment="Stretch" 
                               Fill="Black" 
                                       Margin="1,0,1,0"
                               Visibility="{TemplateBinding SeparatorVisibility}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
Merci à tous pour votre aide