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.v20.1.dll

Declaration

public event EmptyDocumentsHostWindowEventHandler EmptyDocumentsHostWindow
Public Event EmptyDocumentsHostWindow As EmptyDocumentsHostWindowEventHandler

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