Skip to main content

LayoutItem Class

Represents a control that consists of a label and content regions. The LayoutItem cannot be used outside a LayoutControl.

Namespace: DevExpress.Xpf.LayoutControl

Assembly: DevExpress.Xpf.LayoutControl.v22.1.dll


public class LayoutItem :


Visually a LayoutItem consists of a label and content regions. The following image shows a LayoutItem with a label set to “Home phone:” and content set to a TextBox:


You can provide a label via the LayoutItem.Label property. Typically, you assign a text string to this property. However, you can assign any object to the LayoutItem.Label property, and then specify a data template (via the LayoutItem.LabelTemplate property) that will define how the label is rendered on-screen. A label’s style can be customized via the LayoutItem.LabelStyle property. To change the label’s position, use the LayoutItem.LabelPosition property.

A layout item’s content can be specified via the LayoutItem.Content property. When declaring a LayoutItem object in XAML, any object defined between the LayoutItem start and end tags is used to initialize the LayoutItem.Content property.

Typically, LayoutItem objects are used as elements of a LayoutControl. When they are used within a LayoutControl, the content regions of the LayoutItems are automatically aligned:


The following code snippet replicates the control layout shown on the image above.

    <Grid x:Name="LayoutRoot" Background="White">
        <dxlc:LayoutControl Orientation="Vertical" Background="#FFEAEAEA">
            <dxlc:LayoutGroup Orientation="Vertical">
                <dxlc:LayoutGroup Orientation="Horizontal">
                    <dxlc:LayoutGroup Orientation="Vertical">
                        <dxlc:LayoutItem Label="Country:">
                            <TextBox Text="USA"/>
                        <dxlc:LayoutItem Label="City:">
                            <TextBox Text="Seattle"/>
                    <dxlc:LayoutGroup Orientation="Vertical">
                        <dxlc:LayoutItem Label="Region:">
                            <TextBox Text="WA"/>
                        <dxlc:LayoutItem Label="Postal Code:">
                            <TextBox Text="98122"/>
                <dxlc:LayoutItem Label="Address:">
                    <TextBox Text="507 - 20th Ave.E. Apt.2A"/>
            <dxlc:LayoutGroup Orientation="Horizontal">
                <dxlc:LayoutItem Label="Home Phone:">
                    <TextBox Text="(206) 555-9857"/>
                <dxlc:LayoutItem Label="Extension:">
                    <TextBox Text="5467"/>

Refer to the Aligning contents of LayoutItems for more information.


See Also