2010-07-16 11 views
2

Dans mon fichier .xaml, comment puis-je définir la taille par défaut de TextBlock, de sorte que je n'ai pas besoin d'inclure cet attribut dans l'élément TextBlock?Comment changer la police de caractères Xaml TextBox par défaut

<UserControl.Resources> 
<!-- how?/can i set the default font size for textblock element here? --> 
</UserControl.Resources> 

<Grid> 
    <StackPanel> 
     <TextBlock Text="{Binding HelloWorld}" /> 
    </StackPanel> 
</Grid> 

Répondre

2

Placez ce au lieu de votre commentaire à UserControl.Resources

<Style TargetType="TextBlock"> 
    <Setter Property="FontSize" Value="20" /> 
</Style> 
Questions connexes