windowsforms-11361-controls-and-libraries-application-ui-manager-examples-how-to-display-documents-using-a-tabbed-ui.md
This example enables a tabbed UI for a DocumentManager. The example creates two document groups. MDI child windows are presented as tab pages.
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();
}
}
}
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