I want to close a System.Windows.Window if the user clicks anywhere outside it. The Window is shown as a Dialogbox. How do I receive clicks outside a wpf window?
AppointmentDetailsView.ShowDialog();
How about this?
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
protected override void OnDeactivated(EventArgs e)
{
base.OnDeactivated(e);
Close();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With