Back to Devexpress

TabbedView Class

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-tabbed.md

latest6.8 KB
Original Source

TabbedView Class

Presents MDI child windows as a tabbed UI.

Namespace : DevExpress.XtraBars.Docking2010.Views.Tabbed

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public class TabbedView :
    BaseView,
    IThumbnailViewClient,
    IFreeLayoutView,
    ISupportBatchUpdate,
    ISupportAdornerUIManager,
    IWin32Window,
    IUpdateAdornerUI
vb
Public Class TabbedView
    Inherits BaseView
    Implements IThumbnailViewClient,
               IFreeLayoutView,
               ISupportBatchUpdate,
               ISupportAdornerUIManager,
               IWin32Window,
               IUpdateAdornerUI

Remarks

MDI child windows can be presented by a DocumentManager either as a native MDI or tabbed UI. To use the tabbed UI, create a TabbedView object and assign it to the DocumentManager.View property. To enable a native MDI, create a NativeMdiView object and assign it to the DocumentManager.View property.

Documents in a TabbedView are displayed as tabs. You can split the View’s area vertically or horizontally into document groups. In code, you can create a new group via the ITabbedViewController.CreateNewDocumentGroup method accessible via the View’s Controller object. An end-user can split the area via a document’s context menu or drag-and-drop.

When you do not create extra groups, there is one default group that displays all documents. When document groups are created, they are added to the TabbedView.DocumentGroups collection.

The number of documents displayed simultaneously in a group can be limited via the IDocumentGroupProperties.MaxDocuments and IDocumentGroupDefaultProperties.MaxDocuments properties.

Example

This example enables a tabbed UI for a DocumentManager. The example creates two document groups. MDI child windows are presented as tab pages.

csharp
using DevExpress.XtraEditors;
using DevExpress.XtraBars.Docking2010;
using DevExpress.XtraBars.Docking2010.Views.Tabbed;
using System.Windows.Forms;

namespace DXApplication {
    public partial class Form1 : XtraForm {
        DocumentManager docManager;
        public Form1() {
            InitializeComponent();

            InitDocumentManager();
            AddChildForms(5);
            AddDocumentGroup(Orientation.Vertical, 2);
        }
        void InitDocumentManager() {
            docManager = new DocumentManager(components) {
                MdiParent = this,
                View = new TabbedView()
            };
        }
        void AddChildForms(int count) {
            for (int i = 0; i < count; i++)
                AddChildForm(i);
        }
        void AddDocumentGroup(Orientation groupOrientation, int documentIndex) {
            (docManager.View as TabbedView).Controller.CreateNewDocumentGroup(docManager.View.Documents[documentIndex] as Document, groupOrientation);
        }
        void AddChildForm(int number) {
            XtraForm childForm = new XtraForm() {
                Text = string.Format("Child Form ({0})", number),
                MdiParent = this
            };
            SimpleButton btn = new SimpleButton() {
                Text = string.Format("Button"),
                Parent = childForm
            };
            childForm.Show();
        }
    }
}
vb
Imports DevExpress.XtraEditors
Imports DevExpress.XtraBars.Docking2010
Imports DevExpress.XtraBars.Docking2010.Views.Tabbed
Imports System.Windows.Forms

Namespace DXApplication
    Partial Public Class Form1
        Inherits XtraForm

        Private docManager As DocumentManager
        Public Sub New()
            InitializeComponent()

            InitDocumentManager()
            AddChildForms(5)
            AddDocumentGroup(Orientation.Vertical, 2)
        End Sub
        Private Sub InitDocumentManager()
            docManager = New DocumentManager(components) With {
                .MdiParent = Me,
                .View = New TabbedView()
            }
        End Sub
        Private Sub AddChildForms(ByVal count As Integer)
            For i As Integer = 0 To count - 1
                AddChildForm(i)
            Next i
        End Sub
        Private Sub AddDocumentGroup(ByVal groupOrientation As Orientation, ByVal documentIndex As Integer)
            TryCast(docManager.View, TabbedView).Controller.CreateNewDocumentGroup(TryCast(docManager.View.Documents(documentIndex), Document), groupOrientation)
        End Sub
        Private Sub AddChildForm(ByVal number As Integer)
            Dim childForm As New XtraForm() With {
                .Text = String.Format("Child Form ({0})", number),
                .MdiParent = Me
            }
            Dim btn As New SimpleButton() With {
                .Text = String.Format("Button"),
                .Parent = childForm
            }
            childForm.Show()
        End Sub
    End Class
End Namespace

Inheritance

Object MarshalByRefObject Component BaseComponent BaseView TabbedView

See Also

TabbedView Members

View

DevExpress.XtraBars.Docking2010.Views.Tabbed Namespace