This is C# WPF application. I have a Button that close the application. Is there a default close event as that of the (x) button of the top right corner of the Window.
Basically I hope there is a pure XAML solution like the following:
<Button CloseWhenClick></Button>
Instead of this:
<Button Click="CloseWindow_Click"></Button>
private void Close(object sender, RoutedEventArgs e)
{
Window.Close();
}
[EDIT – ANSWER]
What I was looking for:
<Button Command="Close"></Button>
There is no such consept like “default” closing event, but thre is in WPF a Command concept. Bind your relay command to that button and you done. Here is a link on Q&A : WPF Standard Commands – Where's Exit?.
Hope this helps.
Regards.