ContentItem.Content Property
Gets or sets the item's content. This is a dependency property.
Namespace: DevExpress.Xpf.Docking
Assembly: DevExpress.Xpf.Docking.v14.2.dll
#Declaration
#Property Value
Type | Description |
---|---|
Object | An object that specifies the item's content. |
#Remarks
This property is marked with the System.Windows.Markup.ContentPropertyAttribute attribute. So in XAML, any object defined between the current item's start and end tags is used to initialize the Content property.
For LayoutPanel objects, you can assign a UIElement or LayoutGroup object to the Content property. The LayoutPanel.Control and LayoutPanel.Layout properties are synchronized with the Content property. If you assign a UIElement to the Content, this object is also accessible via the Control property, while the Layout property returns null. If you assign a LayoutGroup to the Content property, the Layout property will also return this LayoutGroup, while the Control property will return null.
Initializing the Content property with a LayoutGroup object becomes useful when you want to create a consistent layout of controls within a LayoutPanel. A LayoutGroup is a container that arranges its items either horizontally or vertically. When creating a layout of controls, typical elements of a LayoutGroup are LayoutControlItem objects and other LayoutGroups.
For a DocumentPanel object, which is a LayoutPanel descendant, the Content property can also be set to a Uri object. This comes in handy when you need to display the contents of another Window, Page or UserControl within a DocumentPanel. To load the contents of an external Window, Page or UserControl into a new DocumentPanel, use the DockController.AddDocumentPanel method.
When the Uri object refers to a Window or Page, only the contents of the Window/Page are loaded, not the objects themselves. After the load, the DocumentPanel's Control property will refer to the root element of the loaded XAML (for instance, a Grid object). When the XAML file contains a UserControl, the UserControl will be loaded, and the DocumentPanel's Control property will refer to a UserControl class instance.