簡體   English   中英

使用Windows Phone Runtime 8.1應用程序中的代碼訪問另一個主題的主題資源

[英]Access theme resources of another theme using code in Windows Phone Runtime 8.1 Apps

我知道Windows Phone Runtime 8.1具有多個主題ThemeDictionaries用於像Windows Runtime 8這樣的不同主題。

但是似乎我只能使用諸如Application.Current.Resources["PhoneAccentBrush"]類的代碼訪問當前正在使用的主題的主題資源(可能取決於Application.RequestedTheme嗎?)。

我可以在App.xaml覆蓋Default主題以覆蓋所有主題的顏色,但是我可以用代碼實現嗎?

Application.Resources主題資源取決於Application.RequestedTheme

但是FrameworkElement.Resources取決於FrameworkElement.RequestedTheme

因此從(Window.Current.Content as FrameworkElement).Resources覆蓋資源。資源將使用主題資源覆蓋當前資源(如果沒有子元素覆蓋其RequestedTheme )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM