Reputation: 2898
Hi in my application i displaying the news details. It contains template(hedaline, said by and story). I need to set the foreground of the each textblock as "White" irrespective of the theme color change. Is there any common plalce set the foreground color so it will affect whole page.
Please help me , dont tell me to set the foreground to all textblocks.
Upvotes: 0
Views: 1215
Reputation: 1525
you can refer to this link http://innovativesingapore.com/2010/08/experession_phone/ for creating style as follows
<phone:PhoneApplicationPage.Resources>
<Style x:Key="MyStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
</phone:PhoneApplicationPage.Resources>
And apply to the Text blocks as
<TextBlock Height="49" Name="textblock" Margin="67,49,0,0" Text="WhiteForegroundText" Style="{StaticResource MyStyle}" />
Upvotes: 0
Reputation: 39006
If you want it only affects the whole page, add a Foreground
color to the page like this,
<phone:PhoneApplicationPage Foreground="{StaticResource PhoneAccentBrush}" ...
Please note that if you apply any style to your TextBlocks
on this page, this color (in this case PhoneAccentBrush
) will be overwritten by the color defined in the TextBlock
's style.
Upvotes: 1
Reputation: 26344
Define a Style
(without a x:Key
) for a TextBlock
and it'll automatically affect all TextBlock
in your application.
Upvotes: 4