Class DataFormDisplayOptionsAttribute
Provides attribute-based display configuration options for fields in the SfDataForm component, enabling enhanced layout customization and editor arrangement.
Inheritance
Namespace: Syncfusion.Blazor.DataForm
Assembly: Syncfusion.Blazor.dll
Syntax
public sealed class DataFormDisplayOptionsAttribute : Attribute
Remarks
Use the DataFormDisplayOptionsAttribute to designate specific display preferences for fields generated within the SfDataForm. It is most commonly applied to model properties for fine-grained control of data form layouts.
Examples
The following example demonstrates how to apply the DataFormDisplayOptionsAttribute to a model property for column spanning.
public class Employee
{
[DataFormDisplayOptions(ColumnSpan = 2)]
public DateTime HireDate { get; set; }
}
Constructors
DataFormDisplayOptionsAttribute()
Declaration
public DataFormDisplayOptionsAttribute()
Properties
ColumnSpan
Gets or sets the column span that indicates how many columns a field editor should occupy within the form layout in the SfDataForm component.
Declaration
public int ColumnSpan { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An |
Remarks
This property is particularly useful in auto-generated forms when fields should cover multiple columns within column-based layouts. Applying ColumnSpan ensures the respective field will visually expand across the desired number of columns.
Usage Example:
[DataFormDisplayOptions(ColumnSpan = 2)]
public DateTime DateTimeValue { get; set; }
When both the ColumnSpan property of the DataFormDisplayOptionsAttribute and the ColumnSpan property of the SfDataForm component are specified, the attribute value on the property takes precedence.
Examples
This example shows how to set the column span for a date field:
[DataFormDisplayOptions(ColumnSpan = 2)]
public DateTime DateOfBirth { get; set; }