[ACCEPTED]-WPF - How to access method declared in App.xaml.cs?-wpf
Accepted answer
((App)Application.Current).YourMethod ....
0
Have you considered to create a separate 2 class to hold your application wide methods 1 (eg. AppState.cs)?
You can also add a static property in your 3 App
class with new
modifier like so:
public static new App Current => Application.Current as App;
This way you 2 can access your method like so:
App.Current.YourMethod()
Check this answer 1 about new modifier on SO.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.