[ACCEPTED]-WPF - How to access method declared in App.xaml.cs?-wpf

Accepted answer
Score: 75
((App)Application.Current).YourMethod ....

0

Score: 3

Have you considered to create a separate 2 class to hold your application wide methods 1 (eg. AppState.cs)?

Score: 0

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.

More Related questions