DxFormLayout.Data Property
Specifies a data item that is bound to the Form Layout items.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
#Declaration
[DefaultValue(null)]
[Parameter]
public object Data { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Object | null | A data item. |
#Remarks
The Data
property specifies a data item from which the Form Layout retrieves its data. Form Layout items must be declared and bound to the data item fields using the Field property. Each item automatically displays a DevExpress data editor suitable for the target data type.
The following example binds the Form Layout to a data item.
<DxFormLayout Data="@editFormData" >
<DxFormLayoutItem Field="@nameof(FormDataItem.Name)" ... />
<DxFormLayoutItem Field="@nameof(FormDataItem.Birthday)" ... />
<DxFormLayoutItem Field="@nameof(FormDataItem.Worked)" ... />
<DxFormLayoutItem Field="@nameof(FormDataItem.Position)" ... />
</DxFormLayout>
@code {
FormDataItem editFormData = new FormDataItem() {
Name = "Nancy Davolio",
Birthday = DateTime.Now.AddYears(-30),
Worked = 3,
Position = "Sales Representative"
};
}
You can also bind an item to a complex field (a field that belongs to a data collection’s nested object). To access a complex field, use the following syntax: NestedObject.FieldName
.