none
WP8 - Style/Theme/Brush override does not work. Any suggestions?

    Question

  • Hi,

    I'm porting a WP7 App to WP8.

    The Apps uses it's own ThemeResources to override the Systeme Theme (the Font color should always be black no matter if the user has choosen dark or light theme) added to the
    ResourceDictionary within the App.xaml.

    This works fine for WP7 but WP8 seems to ignore any Brush / Style overrides to System Resources.

    I started a new WP8 App, placed a Textblock on the Mainpage and set the Foreground to {StaticResource PhoneForegroundBrush}
    <TextBlock Text="Hello World" Foreground="{StaticResource PhoneForegroundBrush}"/>

    Afterwards I added a Resource to the Page.Resources like <SolidColorBrush x:Key="PhoneForegroundBrush" Color="Green" />

    But when i start the App the Font Color stays white. A very interesting fact about that is, that the designer in VS and Blend
    show the Green Color for the Textblock but the running app seems to ignore this override.

    Is this a Bug or works as expected?

    Of course i could write my own styles and assign it to every Textblock but this should be unnecessary if i could override PhoneForegroundBrush

    Kind Regards

    Kai
    Wednesday, November 21, 2012 5:26 PM

All replies

  • Hello Kai

    Were you able to find any workaround?

    I don't have exactly the same but somewhat similar problem. I am using external fonts, the fonts are working fine on WP7 project, when I am porting it to WP8, the font's don't work.

    It seems like something is missing/wrong with the SDK.

    Please share if you have found something interesting.

    Best regards

    Ali

    Thursday, January 3, 2013 12:11 PM
  • Hi Ali,

    unfortunately not :(

    Seems like the only working solution is to define everything in an own style.

    The only thing that seems to work is to generaly override the Textblock Style:

    <Style TargetType="TextBlock">
      <Setter Property="Foreground" Value="Red"/>
    </Style>

    Hope this gets fixed with an update.

    Greetings

    Kai

    Thursday, January 3, 2013 12:36 PM