2012-03-17 48 views
0

當應用程序重新激活時,是否有任何方法可以立即應用主題更改? 黑暗/光線似乎與它啓動時相同。是否有任何方法可以立即應用主題更改?

// Determine the visibility of the dark background. 
    Visibility darkBackgroundVisibility = 
     (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"]; 

    // Write the theme background value. 
    if (darkBackgroundVisibility == Visibility.Visible) 
    { 
     MessageBox.Show("background = dark"); 
    } 
    else 
    { 
     MessageBox.Show("background = light"); 
    } 

回答

0

你可以嘗試使用Phoney Tools庫,並檢查PhoneTheme.IsDarkTheme屬性。我以前使用過它,它似乎運作良好。

+0

謝謝,但它不起作用。因爲這個屬性和我發佈的代碼完全一樣。 [鏈接](http://phoney.codeplex.com/SourceControl/changeset/view/80d07f6c75c5#PhoneyTools%2fSystemResources%2fPhoneThemes.cs) – 2012-03-17 11:16:09

相關問題