Skip to main content

BaseView.EmptyDocumentsHostWindow Event

Fires when the last floating document in the documents host window is closed or the control it contains is disposed, allowing you to specify whether to keep open the empty documents host window.

Namespace: DevExpress.XtraBars.Docking2010.Views

Assembly: DevExpress.XtraBars.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public event EmptyDocumentsHostWindowEventHandler EmptyDocumentsHostWindow

Event Data

The EmptyDocumentsHostWindow event's data class is DevExpress.XtraBars.Docking2010.EmptyDocumentsHostWindowEventArgs.

Remarks

This event is in effect for views that display floating documents in the documents host window in which multiple documents can be docked as tabs. See the BaseView.FloatingDocumentContainer property for details.

For the view in the documents host window, the EmptyDocumentsHostWindow event fires when:

The Reason property of the EmptyDocumentsHostWindowEventArgs object, passed to the event handler, returns whether the document has been closed or the control has been disposed.

The HostWindow property returns the IDocumentsHostWindow object that contains the document.

The KeepOpen property allows you to specify whether not to close the host window. If the document is contained in the default documents host window, this property is set to false by default. So, the default host window is automatically closed. If a custom host window is used to contain floating documents (see BaseView.CustomDocumentsHostWindow), the KeepOpen property is set to true, by default.

To subscribe to the EmptyDocumentsHostWindow event of the view in the documents host window, use the BaseView.RegisterDocumentsHostWindow event of the main view. See the example below.

public Form1()
{
    InitializeComponent();
    tabbedView1.RegisterDocumentsHostWindow += tabbedView1_RegisterDocumentsHostWindow;
    tabbedView1.UnregisterDocumentsHostWindow += tabbedView1_UnregisterDocumentsHostWindow;
}
void tabbedView1_RegisterDocumentsHostWindow(object sender, DevExpress.XtraBars.Docking2010.DocumentsHostWindowEventArgs e)
{
    e.HostWindow.DocumentManager.View.EmptyDocumentsHostWindow += View_EmptyDocumentsHostWindow;
}
void tabbedView1_UnregisterDocumentsHostWindow(object sender, DevExpress.XtraBars.Docking2010.DocumentsHostWindowEventArgs e)
{
    e.HostWindow.DocumentManager.View.EmptyDocumentsHostWindow -= View_EmptyDocumentsHostWindow;
}
void View_EmptyDocumentsHostWindow(object sender, DevExpress.XtraBars.Docking2010.EmptyDocumentsHostWindowEventArgs e)
{
    // set the e.KeepOpen property based on custom logic.
}
See Also