windowsforms-11798-controls-and-libraries-application-ui-manager-views-windowsui-view-getting-started-how-to-create-a-page-container.md
Run the Document Manager Designer.
Switch to the designer’s ‘Documents’ section and add a Document by clicking the corresponding button.
Go to the designer’s ‘Tiles’ page. Delete the automatically created Tile via the ‘Delete Tile’ button.
Switch to the designer’s ‘Content Containers’ page and delete the automatically created TileContainer via the ‘Delete Container’ button.
Create a Page container. To do so, click the ‘Add New Container’ button and select ‘Page’ from the drop-down menu.
Go to the designer’s ‘Navigation Tree’ section. Here you can see the application’s hierarchy. The topmost container is our Page. It does not yet contain any documents (its Page.Document property is empty). Add the document to the Page by dragging them from the ‘Documents’ panel into the ‘Page 1’ node. The resulting navigation tree will look like following.
The Document created in step 6 is empty. In order to display content within this document, we will use the Deferred Load feature. With this feature, contents for Documents will be provided on an event. Switch to the designer’s ‘Views’ page and select the WindowsUIView object. In the property grid, switch to events and double-click the BaseView.QueryControl event.
Run the application. The result is demonstrated in the figure below.
You can customize the Page‘s advanced settings in the designer’s ‘Content Containers’ page. For instance you can change the Page‘s caption and orientation according to which its child Document is arranged. Also, to modify container’s appearance settings you can switch to the designer’s ‘Appearance’ page.
This section demonstrates how to create the example in code. Because of automatic Tiles and TileContainer generation (see step 6), we have to use the WindowsUIView.QueryStartupContentContainer to set an application start-up container.
private void windowsUIView1_QueryStartupContentContainer(object sender, DevExpress.XtraBars.Docking2010.Views.WindowsUI.QueryContentContainerEventArgs e) {
WindowsUIView view = sender as WindowsUIView;
//Creating a document
DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document doc1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() { Caption = "Document 1" };
view.Documents.Add(doc1);
//Creating and populating content container
DevExpress.XtraBars.Docking2010.Views.WindowsUI.Page page1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Page();
page1.Document = doc1;
view.ContentContainers.Add(page1);
//Additional settings
page1.Caption = "Page";
page1.Properties.Orientation = Orientation.Vertical;
view.AppearanceCaption.ForeColor = System.Drawing.Color.OrangeRed;
//Setting a start-up container
e.ContentContainer = page1;
}
private void windowsUIView1_QueryControl(object sender, DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs e) {
e.Control = new RichEditControl() { Text = "Text 1" };
}
Private Sub windowsUIView1_QueryStartupContentContainer(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Docking2010.Views.WindowsUI.QueryContentContainerEventArgs)
Dim view As WindowsUIView = TryCast(sender, WindowsUIView)
'Creating a document
Dim doc1 As New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() With {.Caption = "Document 1"}
view.Documents.Add(doc1)
'Creating and populating content container
Dim page1 As New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Page()
page1.Document = doc1
view.ContentContainers.Add(page1)
'Additional settings
page1.Caption = "Page"
page1.Properties.Orientation = Orientation.Vertical
view.AppearanceCaption.ForeColor = System.Drawing.Color.OrangeRed
'Setting a start-up container
e.ContentContainer = page1
End Sub
Private Sub windowsUIView1_QueryControl(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs)
Dim TempRichEditControl As RichEditControl = New RichEditControl() { Text = "Text 1" }
e.Control = New RichEditControl() { Text
End Sub