I created a WPF application in c# with 3 different windows, Home.xaml, Name.xaml, Config.xaml. I want to declare a variable in Home.xaml.cs that I
To avoid having to pass around values between windows and usercontrols, or creating a static class to duplicate existing functionality within WPF, you could use:
App.Current.Properties["NameOfProperty"] = 5;string myProperty = App.Current.Properties["NameOfProperty"];This was mentioned above, but the syntax was a little off.
This provides global variables within your application, accessible from any code running within it.