Back to Devexpress

How To: Create a SplitGroup Container

windowsforms-11796-controls-and-libraries-application-ui-manager-views-windowsui-view-getting-started-how-to-create-a-splitgroup-container.md

latest8.7 KB
Original Source

How To: Create a SplitGroup Container

  • Oct 29, 2020
  • 4 minutes to read

Prerequisites

  1. Create a Windows Forms Application.
  2. Windows UI applications are generally designed to run in full-screen mode. Modify the main form to meet these requirements. Set the FormBorderStyle property to None and the WindowState property to Maximized.
  3. Drop a DocumentManager component on the form.
  4. Change the DocumentManager‘s View to WindowsUI View. Click the DocumentManager‘s smart tag and select the Convert To WindowsUIView option.

Creating Split Group

  1. Run the Document Manager Designer.

  2. Switch to the designer’s ‘Documents’ section and add 2 Documents by clicking the corresponding button.

  3. Go to the designer’s ‘Tiles’ page. Delete the automatically created Tiles via the ‘Delete Tile’ button.

  4. Switch to the designer’s ‘Content Containers’ page and delete the automatically created TileContainer via the ‘Delete Container’ button.

  5. Create a SplitGroup container. To do so, click the ‘Add New Container’ button and select ‘SplitGroup’ from the drop-down menu.

  6. Go to the designer’s ‘Navigation Tree’ section. Here you can see the application’s hierarchy. The topmost container is our SplitGroup. It does not yet contain any documents (its inherited DocumentGroup.Items collection is empty). Add documents to the SplitGroup by dragging them from the ‘Documents’ panel into the ‘Items’ node. The resulting navigation tree will look like following.

  7. The Documents created in step 6 are empty. In order to display content within these documents, we will use the Deferred Load feature. With this feature, contents for Documents will be provided via 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.

  8. Run the application. The result is demonstrated in the figure below.

Additional Settings

You can customize the SplitGroup‘s advanced settings in the designer’s ‘Content Containers’ page. For instance you can change the SplitGroup‘s caption and orientation according to which child Documents are arranged.

To modify appearance settings for the current container, switch to the designer’s ‘Appearances’ page.

SlideGroup and SplitGroup containers have the Overview Screen that displays all child Documents as tiles. The Overview Screen is invoked via the related button on Navigation Bars.

You can customize this screen by using properties, accessed through the WindowsUIView.OverviewContainerProperties group.

Code

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.

csharp
private void windowsUIView1_QueryStartupContentContainer(object sender, DevExpress.XtraBars.Docking2010.Views.WindowsUI.QueryContentContainerEventArgs e) {
    WindowsUIView view = sender as WindowsUIView;
    //Creating documents
    DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document doc1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() { Caption = "Document 1" };
    DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document doc2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() { Caption = "Document 2" };
    view.Documents.AddRange(new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document[] { doc1, doc2 });
    //Creating and populating content container
    DevExpress.XtraBars.Docking2010.Views.WindowsUI.SplitGroup splitGroup1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.SplitGroup();
    splitGroup1.Items.AddRange(new DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document[] { doc1, doc2 });
    view.ContentContainers.Add(splitGroup1);
    //Additional settings
    splitGroup1.Caption = "Slide Group";
    splitGroup1.Properties.Orientation = Orientation.Vertical;
    view.AppearanceCaption.ForeColor = System.Drawing.Color.OrangeRed;
    //Setting a start-up container
    e.ContentContainer = splitGroup1;
}

private void windowsUIView1_QueryControl(object sender, DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs e) {
    if (e.Document == (sender as WindowsUIView).Documents[0]) {
        e.Control = new RichEditControl() { Text = "Text 1" };
    }
    else e.Control = new RichEditControl() { Text = "Text 2" };
}
vb
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 documents
    Dim doc1 As New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() With {.Caption = "Document 1"}
    Dim doc2 As New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() With {.Caption = "Document 2"}
    view.Documents.AddRange(New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() { doc1, doc2 })
    'Creating and populating content container
    Dim splitGroup1 As New DevExpress.XtraBars.Docking2010.Views.WindowsUI.SplitGroup()
    splitGroup1.Items.AddRange(New DevExpress.XtraBars.Docking2010.Views.WindowsUI.Document() { doc1, doc2 })
    view.ContentContainers.Add(splitGroup1)
    'Additional settings
    splitGroup1.Caption = "Slide Group"
    splitGroup1.Properties.Orientation = Orientation.Vertical
    view.AppearanceCaption.ForeColor = System.Drawing.Color.OrangeRed
    'Setting a start-up container
    e.ContentContainer = splitGroup1
End Sub

Private Sub windowsUIView1_QueryControl(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs)
    If e.Document = (TryCast(sender, WindowsUIView)).Documents(0) Then
        e.Control = New RichEditControl() With {.Text = "Text 1"}
    Else
        e.Control = New RichEditControl() With {.Text = "Text 2"}
    End If
End Sub