I have read the post titled How to catch the closed event of xamDialogWindow but I can't see where that helps me.
I want to execute a handler routine when the Close button is clicked. Assuming the WindowStateChanging Event fires when the Close button is clicked, I don't see where this helps. There is no WindowState for Closing or Closed. The only states per documentation are: Hidden, Maximized, Minimized, and Normal. And the WindowStateChangingEventArgs.Cancel property seems intended to allow canceling the WindowStateChanging Event.
So, please elaborate on how to sense a Close button click and execute a procedure in response.
what did you do to solve this problem?
Disregard my last post. I think I've found a way out. Thanks!
Unfortunately, upon further testing, I have found that handling WindowStateChanged doesn't allow me to solve my problem.
I wanted to treat clicking the Close button (X at the right of title bar) same as Cancel. Since the WindowState changes to Hidden, regardless whether the Close button is clicked or the XamDialogWindow Close() method is called, I have no way, that I can see, to distinguish between clicking the Close button vs. clicking an OK button.
Any suggestions on how to solve this?
HI,
The WindowState will be Hidden when the Close Button is clicked.
When the Close Button is clicked the WindowStateChanged and WkndowStateChanging Events will fire.
Here is a code snippet:
private void myDialogWindow_WindowStateChanged(object sender, Infragistics.Controls.Interactions.WindowStateChangedEventArgs e) { MessageBox.Show(e.NewWindowState.ToString()); }
private void myDialogWindow_WindowStateChanging(object sender, Infragistics.Controls.Interactions.WindowStateChangingEventArgs e) { MessageBox.Show(e.NewWindowState.ToString()); }
Sincerely, Matt DSE