Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Collapse]Diagrams
    Getting Started
   [Expand]Diagram Designer
    Diagram Control
   [Expand]End-User Interaction
   [Collapse]Diagram Items
     Shapes
     Default Shapes
     Connectors
     Images
     SVG Shapes
     Containers
   [Expand]Automatic Layout
   [Expand]Data Binding Functionality
    Themes and Styles
    Printing and Exporting
    Saving and Loading Diagrams
   [Expand]Examples
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Containers

Containers provide a visual boundary with a label around items and can be used to group diagram items together.

Containers are encapsulated by DiagramContainer class objects.

End-users can add containers by selecting the corresponding ribbon item on the Insert ribbon page.

Containers can be moved by dragging with the mouse or pressing arrow keys, copied using CTRL+C/CTRL+V key combinations and deleted by pressing the DELETE key. Moving, copying or deleting the container will move, copy or delete its contents as well.

Any item can be placed within a container, including another container. To add or remove items, drag them in or out of the container. The container can automatically grow to fit the contents. This behavior is managed by the DiagramContainerBase.AdjustBoundsBehavior property.

The collection of diagram items placed within the container can be accessed using the DiagramContainerBase.Items property. For items placed within a container, the DiagramItem.Position property specifies the coordinates of the item's upper left corner relative to the container.

Each container has a header. In code, the header can be edited using the DiagramContainer.Header property and hidden by setting the DiagramContainer.ShowHeader property to false. End-users can edit the header by double-clicking the container and toggle the header visibility via the Show Header ribbon item within the Container Tools ribbon category that appears when a container is selected. Additionally, end-users can customize the header and content paddings (the DiagramContainer.HeaderPadding and Padding properties) and select the container style.

By default, dragging corner selection handles resizes the container proportionally. To change the aspect ratio, hold the SHIFT key while dragging a corner selection handle or drag one of the side selection handles. To disable the proportional resizing, set the DiagramOptionsBehavior.EnableProportionalResizing to false.

Expanded See Also

How would you rate this topic?​​​​​​​