0
在我的應用程序需要的幾乎所有的頁面的某些變量的WPF應用程序變量,所以我宣佈他們在Application.xaml像不改變
<sys:String x:key="First">First</sys:String>
,並在一個頁面上我改變的值這樣的代碼
Resources["First"] = "This is First";
當我打電話像
String f = (string)this.TryFindResource("First");
MessageBox.Show(f);
的出來說就是「第一」和n變量在第二頁上
ot「這是第一」。我也嘗試過。
Application.Current.Properties["First"]
的可能的複製[http://stackoverflow.com/questions/910421/how-can-i -save-global-application-variables-in-wpf](http://stackoverflow.com/questions/910421/how-can-i-save-global-application-variables-in-wpf) – 2012-04-08 13:33:35