Back to Devexpress

ITabbedViewController.MoveToMainDocumentGroup(Document) Method

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-tabbed-dot-itabbedviewcontroller-dot-movetomaindocumentgroup-x28-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-tabbed-dot-document-x29.md

latest4.0 KB
Original Source

ITabbedViewController.MoveToMainDocumentGroup(Document) Method

Docks the specific Document to the main DocumentGroup.

Namespace : DevExpress.XtraBars.Docking2010.Views.Tabbed

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
bool MoveToMainDocumentGroup(
    Document document
)
vb
Function MoveToMainDocumentGroup(
    document As Document
) As Boolean

Parameters

NameTypeDescription
documentDocument

A Document to be docked to the Document Group.

|

Returns

TypeDescription
Boolean

true if docking was successfully performed; otherwise, false.

|

Remarks

The MoveToMainDocumentGroup method is in effect only when the target floating Document is hosted within a Documents Host (see the BaseView.FloatingDocumentContainer property for the details). The word ‘main’ in the method’s name signifies the last selected DocumentGroup within the parent application form. So if the parent form contains only one Document Group, the target Document will be docked to it. If two or more Document Groups exist, the Document will be docked into the Group selected last.

The code below illustrates how to dock a Document, currently selected within a Documents Host, back to the main application form by by a BarButtonItem click. To get the currently selected Document, handle the DocumentManager.DocumentActivate event.

csharp
DevExpress.XtraBars.Docking2010.Views.Tabbed.Document currentDoc;

void documentManager1_DocumentActivate(object sender, DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e) {
    currentDoc = e.Document as Document;
}

private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
    tabbedView1.Controller.MoveToMainDocumentGroup(currentDoc);
}
vb
Private currentDoc As DevExpress.XtraBars.Docking2010.Views.Tabbed.Document

Sub documentManager1_DocumentActivate(sender As Object, e As DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs)
    currentDoc = TryCast(e.Document, Document)
End Sub

Private Sub barButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs)
    tabbedView1.Controller.MoveToMainDocumentGroup(currentDoc)
End Sub

At runtime, end-users can move Documents from a floating container to the main group by clicking the corresponding item in the Documents’ context menu (see the figure below).

See Also

ITabbedViewController Interface

ITabbedViewController Members

DevExpress.XtraBars.Docking2010.Views.Tabbed Namespace