How to: Display Documents Using a Tabbed UI
- 2 minutes to read
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();
}
}
}