Hello,
I'm adding some usercontrols to the documenthost via code something like:-
myContentPane = MyXamDockManager.AddDocument("Test Header",null);myContentPane.Content = new ContentUserControl(...);myContentPane2 = MyXamDockManager.AddDocument("Test Header 2",null);myContentPane2.Content = new ContentUserControl(...);
How can I allow the individual instances ContentUserControl to handle the closing event (when the user clicks the cross on the document tab header), eg to prompt the user to save an unsaved document or close without saving?
Thanks,
- Anthony
Hello Anthony,
The content panes that you add in the Document Content Host will still raise their Closing/ed events when you try to close them, so you can handle and cancel them if you need.
ContentPane cp = xamDockManager1.AddDocument("AddedContentPane", new Button());
cp.Closing += new EventHandler<PaneClosingEventArgs>(OnClosing);