Theme にかかわらず背景色と文字色を固定する

 

App.xaml.cs

固定したい色設定だけ定義します。通常は前景色、背景色 必要があれば アクセントカラーあたりでしょう。

public partial class App : Application
{


public App()
{
// キャッチできない例外のグローバル ハンドラーです。
UnhandledException += Application_UnhandledException;

            // Silverlight の標準初期化
InitializeComponent();

            // Phone 固有の初期化
InitializePhoneApplication();

            (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color = Color.FromArgb(255, 255, 0, 0);
            (App.Current.Resources["PhoneForegroundBrush"] as SolidColorBrush).Color = Colors.Yellow;
            (App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush).Color = Colors.Blue;

            // デバッグ中にグラフィックスのプロファイル情報を表示します。
if (System.Diagnostics.Debugger.IsAttached)
{

MainPage.xaml

各ページで、LayoutRootの背景と、SystemTray の設定は必要です。

<phone:PhoneApplicationPage

    shell:SystemTray.IsVisible="True"
    shell:SystemTray.BackgroundColor="{Binding Source={StaticResource PhoneBackgroundBrush}, Path=Color}"
    shell:SystemTray.ForegroundColor="{Binding Source={StaticResource PhoneForegroundBrush}, Path=Color}"
    >

<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">

image ← 白・黒 背景での結果

尚、デザイン上でも変えたい場合は別の処理が必要ですが、それはまた今度。