Posted 9 years ago by Gregory Whitcomb - President & CEO, LittleFlock Systems
I have an application where I want to prompt the user if he attempts to switch the active docking window (either DocumentWindow or ToolWindow) if he has changes from the previous window that haven't been saved. If the user specifies "Cancel", then I want to prevent a switch to the new window. To cancel and return to the previous window, I tried setting DockingWindowEventArgs.Cancel=true in both a WindowActivated as well as WindowDeactivated event handlers for the DockSite... no luck (it doesn't seem to have an effect). Also, I've tried to Activate the previous window within the WindowActivated/WindowDeactivated handlers, but also no luck. When I use SelectionChanged event handlers for the TabbedMdiContainer and ToolWindowContainer, I have limited success (basically, I'm setting SelectedItem within the handlers to the previous window when cancel is desired). The problem with this approach is that rafted windows (when the user moves a documentWindow or ToolWindow off the main window) apparently don't have these event handlers, so I can't check to see if the user's data was changed and then prompt for Cancel. Any ideas? Thanks!