I have the problem that I want to add an event from XAML directly to another class. The standard class, which is used, is the MainWindow.
In my situation I want to define, which class should be used for the event.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Closing_Event(object sender, System.ComponentModel.CancelEventArgs e)
{
}
}
public class differentClass
{
public differentClass()
{
}
private void Window_Closing_Event(object sender, System.ComponentModel.CancelEventArgs e)
{
}
}
Maybe someone can help me, how I can use the event from the second class without any code in the MainWindow.