Search code examples
c#wpfsilverlightwindows-phone

Setting foreground for whole Windows Phone's application


How to change foreground color for all controls in the application? I need to change color for: textboxes, textblocks, borders of buttons.

It will take too long to do it one by one (over 100 controls).


Solution

  • This is what styles are for. You can add styles in your app.xaml file. Something like:

    <Application.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="White" />
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Foreground" Value="White" />
        </Style>
    </Application.Resources>