WPF - How to access method declared in App.xaml.cs?

Viewed 21223

How can I access, using C#, a public instance method declared in App.xaml.cs?

3 Answers

You can also add a static property in your App class with new modifier like so:

public static new App Current => Application.Current as App;

This way you can access your method like so:

App.Current.YourMethod()

Check this answer about new modifier on SO.

Related