ContentItem.Content Property

Gets or sets the item's content. This is a dependency property.

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v20.1.dll

Declaration

public object Content { get; set; }
Public Property Content As Object

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, LayoutGroup or System.Uri object to the Content property. The LayoutPanel.Control, LayoutPanel.Layout and LayoutPanel.Uri 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 and Uri properties return null. If you assign a LayoutGroup to the Content property, the Layout property will also return this LayoutGroup, while the Control and Uri properties will return null.

You can load content of external Window, Page, User Control into LayoutPanel objects by setting the Content property to a System.Uri object referring to a corresponding XAML file. If a System.Uri object is used to specify the LayoutPanel's content , the LayoutPanel.Uri property returns the assigned System.Uri object. See the LayoutPanel.Uri property, to learn more.

Initializing the Content property with a LayoutGroup object is 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.

Examples

This example shows how to arrange controls within LayoutPanels forming a custom layout.

The following image shows the result of the XAML execution:

LayoutPanel_Content_Ex

<Window x:Class="LayoutPanel_Content_Ex.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
        Title="DockLayoutManager">

    <dxdo:DockLayoutManager Name="dockLayoutManager1">
        <dxdo:DockLayoutManager.LayoutRoot>
            <dxdo:LayoutGroup Name="Root">
                <dxdo:LayoutPanel Caption="Panel1">
                    <dxdo:LayoutGroup Orientation="Vertical">
                        <dxdo:LayoutGroup Caption="Personal info"
                                          GroupBorderStyle="GroupBox"
                                          Orientation="Vertical"
                                          ShowCaption="True">
                            <dxdo:LayoutControlItem Caption="Title">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                            <dxdo:LayoutGroup ItemHeight="Auto">
                                <dxdo:LayoutControlItem Caption="First name">
                                    <dxe:TextEdit />
                                </dxdo:LayoutControlItem>
                                <dxdo:LayoutControlItem Caption="Last name">
                                    <dxe:TextEdit />
                                </dxdo:LayoutControlItem>
                            </dxdo:LayoutGroup>
                        </dxdo:LayoutGroup>
                        <dxdo:LayoutGroup Caption="Notes"
                                          GroupBorderStyle="GroupBox"
                                          ShowCaption="True">
                            <dxdo:LayoutControlItem Caption="Notes" 
                                                    ShowCaption="False">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                        </dxdo:LayoutGroup>
                    </dxdo:LayoutGroup>
                </dxdo:LayoutPanel>
                <dxdo:LayoutPanel Caption="Panel2">
                    <dxdo:LayoutGroup Caption="Address info"
                                      GroupBorderStyle="GroupBox"
                                      Orientation="Vertical"
                                      ShowCaption="True">
                        <dxdo:LayoutGroup ItemHeight="Auto">
                            <dxdo:LayoutControlItem Caption="Country">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                            <dxdo:LayoutControlItem Caption="Region">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                        </dxdo:LayoutGroup>
                        <dxdo:LayoutGroup ItemHeight="Auto">
                            <dxdo:LayoutControlItem Caption="City">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                            <dxdo:LayoutControlItem Caption="Postal code">
                                <dxe:TextEdit />
                            </dxdo:LayoutControlItem>
                        </dxdo:LayoutGroup>
                        <dxdo:LayoutControlItem Caption="Address">
                            <dxe:TextEdit />
                        </dxdo:LayoutControlItem>
                    </dxdo:LayoutGroup>
                </dxdo:LayoutPanel>
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager.LayoutRoot>
    </dxdo:DockLayoutManager>

</Window>
See Also