我有很多的顏色從電網的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