Bonjour,

J'essaie de styliser un calendrier avec un style Material Design et le fait de mettre une image ou du svg à la place de l'icône du calendar, le calendrier ne s'ouvre pas, je vous remercie pour votre aide.

Mon style
Code C# : 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
44
45
46
47
48
49
50
51
52
53
54
 
<Style x:Key="ColoredDatePickerStyle" TargetType="DatePicker">
    <Setter Property="Height" Value="30" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="Foreground" Value="Black" />
    <Setter Property="Background" Value="White" />
    <Setter Property="BorderBrush" Value="{StaticResource SecondaryColor}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="DatePicker">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="30" />
                    </Grid.ColumnDefinitions>
 
                    <!-- Bordure -->
                    <Border Grid.ColumnSpan="2"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="4" />
 
                    <!-- Zone de texte -->
                    <DatePickerTextBox x:Name="PART_TextBox"
                                   Grid.Column="0"
                                   Padding="6,2,4,4"
                                   Background="Transparent"
                                   BorderThickness="0"
                                   VerticalContentAlignment="Center"
                                   Foreground="{TemplateBinding Foreground}" />
 
                    <!-- Bouton calendrier -->
                    <Button x:Name="PART_Button"
                        Grid.Column="1"
                        Background="Transparent"
                        BorderBrush="{x:Null}"
                        Focusable="False"
                        Cursor="Hand"
                        ToolTip="Ouvrir le calendrier">
                        <Viewbox Width="16" Height="16">
                            <Canvas Width="24" Height="24">
                    <!-- Icône calendrier  -->
                                <Path Data="M3,6 L5,6 L5,4 L7,4 L7,6 L17,6 L17,4 L19,4 L19,6 L21,6 L21,20 L3,20 Z"
                                  Fill="#F7C23E" />
                            </Canvas>
                        </Viewbox>
                    </Button>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Mon DatePicker
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
<StackPanel Orientation="Horizontal" Margin="0,5">
    <TextBlock Text="Date :" Width="150" VerticalAlignment="Center"/>
    <DatePicker x:Name="DatePicker" Width="200" Style="{StaticResource ColoredDatePickerStyle}"/>
</StackPanel>