Edit this page

Properties, Events and Attributes

RadDataLayout exposes properties and events which are similar to the ones provided by the RadDataEntry control.

Properties

Property Description
DataSource Through this property user can set the business object or a collection of objects that should be edited. When this property is set RadDataLayout generates editors for each public property which does not have its Browsable attribute set to false.
ColumnCount Controls the amount of columns that RadDataLayout will use to arrange the generated controls. Default value is one.
FlowDirection Defines the direction the editors will be generated.
ItemDefaultHeight Sets the height that generated items should have, the default value is 26.
AutoSizeLabels By default, the property value is false and the labels width will equals the longest label width. If you set this property to true, the labels will be sized according to their content.
ShowValidationPanel Gets or sets a value indicating whether the validation panel should appear.
ItemDefaultHeight Sets the height that generated items should have.

Events

There are several events that you will find useful in the context of RadDataLayout:

Event Description
EditorInitializing Occurs when editor is being initialized. In this event you can change the default editors with custom ones.
EditorInitialized Raised when the editor is initialized.
BindingCreating Occurs when a binding object for an editor is about to be created. This event is cancelable.
BindingCreated Occurs when binding object is created.
ItemInitializing This event is fired when the panel that contains the label, editor and validation label is about to be initialized. This event is cancelable.
ItemInitialized Fires when the item is already initialized.
ItemValidating This event is raised when any of the generated editors fires its Validating event.
ItemValidated Occurs when any of the generated editors fires its Validated event.

Attributes

RadDataLayout has support for several attributes that can be used to change the behavior of the control.

Attribute Description
Browsable Defines which properties should be displayed.
DisplayName Determines what text should be displayed in the label that is associated with the editor.
RadRangeAttribute Defines a range that can be used into validation process. This attribute is provided in validation events.

Figure 1: Model With Attributes

datalayout-properties-event-and-attributes 001

Using attributes.

public class Employee
{
    public string FirstName { get; set; }
    [DisplayName("Family Name")]
    public string LastName { get; set; }
    [Browsable(false)]
    public string Occupation { get; set; }
    [RadRange(2000, 3000)]
    public int Salary { get; set; }
    public DateTime StartingDate { get; set; }
}

Public Class Employee
    Public Property FirstName() As String
        Get
            Return m_FirstName
        End Get
        Set(value As String)
            m_FirstName = value
        End Set
    End Property
    Private m_FirstName As String
    <DisplayName("Family Name")> _
    Public Property LastName() As String
        Get
            Return m_LastName
        End Get
        Set(value As String)
            m_LastName = value
        End Set
    End Property
    Private m_LastName As String
    <Browsable(False)> _
    Public Property Occupation() As String
        Get
            Return m_Occupation
        End Get
        Set(value As String)
            m_Occupation = value
        End Set
    End Property
    Private m_Occupation As String
    <RadRange(2000, 3000)> _
    Public Property Salary() As Integer
        Get
            Return m_Salary
        End Get
        Set(value As Integer)
            m_Salary = value
        End Set
    End Property
    Private m_Salary As Integer
    Public Property StartingDate() As DateTime
        Get
            Return m_StartingDate
        End Get
        Set(value As DateTime)
            m_StartingDate = value
        End Set
    End Property
    Private m_StartingDate As DateTime
End Class

See Also