我有很多的颜色从电网的App.xaml
MainPage.xaml中......
结合的App.xaml
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RequestedTheme="Dark">
<Application.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="MyColor">#FFFFFF</SolidColorBrush>
然后我想改变其全部,在像这样的代码
Application.Current.Resources["MyColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 242, 101, 34));
但它不起作用。我可以想念什么吗?当我导航到另一个页面并导航回来时,上面的代码抛出System.Exception
你是什么意思,这是行不通的?它是否会抛出异常,Grid的背景颜色是否无法更改? –
颜色不变。没有例外 – HelloWindowsPhone
当我导航到另一个页面,然后导航回上面的代码抛出一个System.Exception – HelloWindowsPhone