I want to declare some application level variables. These variables changes with values on different pages. I declare a variable like this
<sys:String x:key="Item1">Test</sys:String>
Now in my code I want to change it so the code should be
Application.Current.Properties["Item1"] = "This is a test";
String t = (string)this.TryFindResource("Item1");
MessegeBox.Show(t);
but this code is not changing the value and it always gives "Test" Any Idea how to fix that.
Application properties are unrelated to XAML resources. Do this:
Resources["Item1"] = "This is a test";
String t = (string)this.TryFindResource("Item1");
MessageBox.Show(t);
But really what you should probably be doing instead here is the MVVM pattern (google it)