none
WPF problème affichage de la police Segoe MDL2 Assets dans MainWindow RRS feed

  • Question

  • Bonjour, dans un projet WPF j'insère dans Main Window deux Boutons en changeant leur police en Segoe MDL2 Assets.

    Voici le code xaml :

      <Button Style="{StaticResource MDL2Assets}" Content="&#xE115;"
                    Margin="20"
                    Focusable="False"/>

    et le code du Style du bouton :

     <Style x:Key="MDL2Assets" TargetType="{x:Type Button}">
            <Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
            <Setter Property="Foreground" Value="{DynamicResource WordColor}"/>
            <Setter Property="FontSize" Value="80"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border x:Name="OuterBorder">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background)"
                                                                               Storyboard.TargetName="OuterBorder">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <SolidColorBrush Color="Transparent"/>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid>
                                <Border x:Name="Background">
                                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                        <ContentPresenter x:Name="CP" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                    </Grid>
                                </Border>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    Dans le concepteur de Visual Studio tout est ok :

    par contre quand je Debug le projet voila ce que j'obtient :


    JF Collombet ® CreateSpecificCulture

    jeudi 2 février 2017 05:06