Reputation: 1187
I've got some TextBlock in my wp8 app which have the same style: for example, they all need to be underlined, bold and something else..
Is there the possibility to centralize this common style without repeating all style's declarations for each TextBlock in my application?
Could you give me some working example?
Thanks in advance!
Upvotes: 1
Views: 1694
Reputation: 1794
In App.xaml resources you can define global styles for all pages. If you want to have the same style for all TextBlock
, the style has to contain only TargetType
, but not x:Key
.
<Application.Resources>
<ResourceDictionary>
<!-- All TextBlock(s) -->
<Style
TargetType="TextBlock">
<Setter
Property="FontSize"
Value="{StaticResource PhoneFontSizeExtraLarge}" />
<Setter
Property="FontWeight"
Value="Bold" />
<!-- something else -->
</Style>
</ResourceDictionary>
</Application.Resources>
Upvotes: 2