Step 1 - Document Manager
- 2 minutes to read
In this lesson, you will learn how to use the Document Manager component.
Start the Visual Studio IDE and create a new .NET Framework Windows Forms Application. You can use predefined app templates from the DevExpress WinForms App Template Gallery:
Locate the
DocumentManager
component in the Visual Studio Toolbox and drop it onto your form:Right-click your project in Solution Explorer to invoke the context menu, and then select Add DevExpress Item | User Control…. Add two User Controls to the project (
XtraUserControl1
,XtraUserControl2
):Add UI controls to User Controls and customize their properties as needed.
Build the solution.
- Switch to
Form1
. Select theDocumentManager
component and invoke its smart tag menu. AlthoughDocumentManager
uses the Tabbed View, you can use the ‘Convert to…’ links to change the view. In the same context menu, click Run Designer to run the Document Manager’s Designer:
Switch to Documents and add two documents:
For each document, use the ControlTypeName property’s drop-down menu to assign a User Control to the document:
Note
In v24.1+, you can add User Controls and Forms to documents at design time (in Visual Studio). In previous versions, handle the QueryControl event to assign content to documents:
void tabbedView1_QueryControl(object sender, DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs e) { if (e.Document.ControlName == "UserControl1") e.Control = new UserControl1(); else e.Control = new UserControl2(); }
The image below shows the result:
In the next lesson, you will learn how to combine the Document Manager with the Dock Manager in your Windows Forms application.