We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DocumentContainer

I am trying to capture an event that would signify that a loaded document is closing.

After adding a new UserControl to the Items collection, i try registering for the DocumentClosing event but don't receive anything.

Any thoughts ?


6 Replies

BA Balavasanth Syncfusion Team August 22, 2008 07:56 AM UTC


Hi Erik,

Currently it is not possible to capture an event that would signify that a loaded document is closing. This has been considered as a defect with the Document Container. This will be fixed once DocumentContainer integration with DockingManager gets implemented.

Please let us know if you have any questions.

Thanks for your interests in Syncfusion products.

Regards,
Bala.





PN Paw Nielsen September 22, 2009 09:56 AM UTC

Has this defect been rectified yet?


CS C. Sudha Syncfusion Team September 23, 2009 10:05 AM UTC

Hi Paw,

Thank you for your interest in Syncfusion products.

We have implemented an event called DocumentClosing associated with the Document Container, using which you can achieve your requirements. Kindly make use of the code snippet for more idea.

In Document Container control:

[XAML]





[C# Code]

private void DocumentContainer_DocumentClosing(object sender, CancelingRoutedEventArgs e)
{
MessageBoxResult res = MessageBox.Show("Do you really want to close this window?", "Attention", MessageBoxButton.YesNo, MessageBoxImage.Asterisk);
e.Cancel = !(MessageBoxResult.Yes == res);
}


In DockingManager control:

[XAML]

ContainerMode="MDI">
syncfusion:DockingManager.Header="Docking Manager"
/>


[C# Code]

private void DockingManager_DocumentClosing(object sender, CancelingRoutedEventArgs e)
{
MessageBoxResult res = MessageBox.Show("Do you really want to close this window?", "Attention", MessageBoxButton.YesNo, MessageBoxImage.Asterisk);
e.Cancel = !(MessageBoxResult.Yes == res);
}

Please let me know if you have any question.

Regards,
SudhaC.


PN Paw Nielsen September 24, 2009 12:42 PM UTC

Thanks SudhaC,

I am using the Docking Manager.
If the user opens the tab-context menu and clicks "Close" then the DocumentClosing event does not fire, I can catch CloseButtonClick but this event does not allow me to cancel the closure of the document.
I am missing something?


PN Paw Nielsen September 25, 2009 08:45 AM UTC

FYI for now I have solved this problem by implementing my own context menu on the tab item:

XAML:



















C# Code-behind:

private void Tab_Close(object sender, RoutedEventArgs e)
{
// check if closing should be cancelled (add your own implementation)
if (!WasCanceled...)
{
// close the window
dockingManager.Children.Remove(dockingManager.ActiveWindow);
}
}
private void Tab_Float(object sender, RoutedEventArgs e)
{
dockingManager.ActiveWindow.SetValue(DockingManager.StateProperty, DockState.Float);
}

private void Tab_Dock(object sender, RoutedEventArgs e)
{ dockingManager.ActiveWindow.SetValue(DockingManager.StateProperty, DockState.Dock);
}

private void Tab_Document(object sender, RoutedEventArgs e)
{ dockingManager.ActiveWindow.SetValue(DockingManager.StateProperty, DockState.Document);
}


HK Hemanth Kumar K Syncfusion Team September 28, 2009 03:54 AM UTC

Hi Paw,

Sorry for the inconvenience caused We found that this is an issue with DocumentContainer and we filed bug report for this. Kindly create new incident in our direct-trac system so that we can update you with custom assemblies. Also We have noticed you've submitted a number of specific technical inquiries here in the Forums which seem to indicate you are a current customer rather than an evaluator or tester. If so, you might like to
know that you have an existing personal Direct-Trac account available using your own email address, and we highly recommend using your personal account. You'll get a faster response along with an automatic update when your question is answered via DirectTrac, and you can login and view your
incident history 24x7.
Simply visit
https://www.syncfusion.com/Support/DirectTrac/logon.aspx?URL=/Support/DirectTrac/default.aspx to
login. If you have any further questions, we hope you will take advantage of your existing account and
available services as a license holder.


Regards,
Hemanth Kumar K

Loader.
Live Chat Icon For mobile
Up arrow icon