Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Windows Phone Runtime 8.1应用程序中的代码访问其他主题的主题资源_C#_Windows Runtime_Windows Phone 8.1 - Fatal编程技术网

C# 使用Windows Phone Runtime 8.1应用程序中的代码访问其他主题的主题资源

C# 使用Windows Phone Runtime 8.1应用程序中的代码访问其他主题的主题资源,c#,windows-runtime,windows-phone-8.1,C#,Windows Runtime,Windows Phone 8.1,我知道Windows Phone Runtime 8.1有几个主题词典,用于不同的主题,如Windows Runtime 8 但我似乎只能访问当前使用主题的主题资源,这可能取决于应用程序。RequestedTheme?使用类似Application.Current.Resources[PhoneAccentBrush]的代码 我可以在我的App.xaml中覆盖默认主题以覆盖所有主题的颜色,但我可以用代码实现吗?应用程序中的主题资源。资源取决于应用程序。请求主题 但是FrameworkElemen

我知道Windows Phone Runtime 8.1有几个主题词典,用于不同的主题,如Windows Runtime 8

但我似乎只能访问当前使用主题的主题资源,这可能取决于应用程序。RequestedTheme?使用类似Application.Current.Resources[PhoneAccentBrush]的代码

我可以在我的App.xaml中覆盖默认主题以覆盖所有主题的颜色,但我可以用代码实现吗?

应用程序中的主题资源。资源取决于应用程序。请求主题

但是FrameworkElement.Resources依赖于FrameworkElement.RequestedTheme


因此,将Window.Current.Content中的资源作为FrameworkElement覆盖。如果没有子元素覆盖其请求的主题,则资源将使用主题资源覆盖当前主题。

我不确定这是否可行。Windows 8.1引入了优化的资源加载,其中XAML解析器仅在特定请求时创建资源。