locked
How to apply default phone foreground color to textblock ? RRS feed

  • Question

  • Hi all,

    <TextBlock x:Name="TextDist" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Distance" VerticalAlignment="Top" Margin="312,482,0,0"  FontFamily="/Azimut;component/Fonts.zip#Quartz" Foreground="#FF1BF325" FontWeight="Bold" FontSize="21.333" />

    i have this to set the color of my textblock. I woud like to set automaticaly the color of the TextBlock in same color of Phone Default color.

    if phone icone color is pink i want same color for my textblock.

    Thx alote for your help.

    Kulrica

    Thursday, April 4, 2013 3:18 PM

Answers

  • The default color is white (for dark background theme). I think you're talking about the accent color.

    Foreground="{StaticResource PhoneAccentBrush}"

    • Marked as answer by Kulrica Friday, April 5, 2013 7:48 AM
    Friday, April 5, 2013 4:44 AM

All replies

  • Windows Phone has pre-defined theme resources which has various Brushes/Color for different purpose. You can use "PhoneForegroundBrush" to set Phone Default brush.

    <TextBlock x:Name="TextDist" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Distance" VerticalAlignment="Top" Margin="312,482,0,0"  FontFamily="/Azimut;component/Fonts.zip#Quartz" Foreground="{staticResource PhoneForegroundBrush" FontWeight="Bold" FontSize="21.333" />

    You can refer following link for more details

    http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769552(v=vs.105).aspx


    Gaurav Khanna | Microsoft VB.NET MVP | Microsoft Community Contributor


    • Edited by Khanna Gaurav Thursday, April 4, 2013 6:53 PM
    • Proposed as answer by MJCDev Thursday, April 4, 2013 9:59 PM
    Thursday, April 4, 2013 6:52 PM
  • i have try this but my text display withe ... my theme is red

    thx for the answer.

    Thursday, April 4, 2013 10:16 PM
  • The default color is white (for dark background theme). I think you're talking about the accent color.

    Foreground="{StaticResource PhoneAccentBrush}"

    • Marked as answer by Kulrica Friday, April 5, 2013 7:48 AM
    Friday, April 5, 2013 4:44 AM
  • Thx alote !!!
    Friday, April 5, 2013 7:49 AM