[英]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.