Skip to main content

DataLayoutControl Class

A data-bound version of the LayoutControl.

Namespace: DevExpress.Xpf.LayoutControl

Assembly: DevExpress.Xpf.LayoutControl.v23.2.dll

NuGet Package: DevExpress.Wpf.LayoutControl

Declaration

public class DataLayoutControl :
    LayoutControl

Remarks

The DataLayoutControl is a data-bound version of its ancestor - the LayoutControl. The DataLayoutControl provides an easy way to create a layout for editing public properties of a bound object (DataLayoutControl.CurrentItem).

Refer to the following help topic for more information: Data Layout Control.

The following code snippet uses the Data Layout Control to display the data:

DataLayoutControl - Code Snippet Result

<Window x:Class="DataLayoutControl.View"
        ...
        xmlns:local="clr-namespace:DataLayoutControl"
        xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol">
    <Window.DataContext>
        <local:MainViewModel/>
    </Window.DataContext>
    <Grid>
        <dxlc:DataLayoutControl CurrentItem="{Binding SelectedObject}"/>
    </Grid>
</Window>
using System;
using System.ComponentModel.DataAnnotations;

namespace DataLayoutControl {
    public class Person {
        [Display(GroupName = "<Name>", Name = "Last name")]
        public string LastName { get; set; }

        [Display(GroupName = "<Name>", Name = "First name", Order = 0)]
        public string FirstName { get; set; }

        [Display(GroupName = "Contact", Order = 2), DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        [Display(GroupName = "Contact", Order = 4)]
        public string Email { get; set; }

        [Display(GroupName = "Contact/Address", ShortName = "")]
        public string AddressLine1 { get; set; }

        [Display(GroupName = "Contact/Address", ShortName = "")]
        public string AddressLine2 { get; set; }

        [Display(GroupName = "Personal", Name = "Birth date")]
        public DateTime BirthDate { get; set; }

        [Display(GroupName = "Personal", Order = 3)]
        public Gender Gender { get; set; }

    }
    public enum Gender { Male, Female }
}
using DevExpress.Mvvm;
using System;

namespace DataLayoutControl {
    public class MainViewModel : ViewModelBase {
        public MainViewModel(){
            SelectedObject = (new Person{
                FirstName = "Carolyn",
                LastName = "Baker",
                Email = "carolyn.baker@example.com",
                Phone = "(555)349-3010",
                AddressLine1 = "1198 Theresa Cir",
                AddressLine2 = "Whitinsville, MA",
                Gender = Gender.Female,
                BirthDate = new DateTime(1992, 10, 01)
            });
        }
        public Person SelectedObject { get; set; }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataLayoutControl class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also