Class FormItems
Represents the template and logic for automatically generating form items in a Syncfusion DataForm component.
Inheritance
Namespace: Syncfusion.Blazor.DataForm
Assembly: Syncfusion.Blazor.dll
Syntax
public class FormItems : OwningComponentBase, IFormItems
Remarks
Use the FormItems class to define and customize how form items are displayed, including support for templates, groupings, and automatic item generation. You can include HTML elements or other components inside the template.
Examples
This example demonstrates customizing the appearance and behavior of autogenerated items in Syncfusion DataForm:
<SfDataForm Model="@model">
<FormItems>
<FormItem Field="FirstName"/>
<FormItem Field="LastName"/>
</FormItems>
</SfDataForm>
Constructors
FormItems()
Declaration
public FormItems()
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose(Boolean)
Releases the resources used by the FormItems component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | A |
Remarks
Invokes clean-up and disposal of internal resources and parent-child component references.
Examples
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
GetAutogeneratedItems(List<PropertyInfo>, Boolean)
Automatically generates items based on the provided model property metadata for use in the DataForm UI.
Declaration
protected void GetAutogeneratedItems(List<PropertyInfo> properties, bool isAutogeneration = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Reflection.PropertyInfo> | properties | A list of System.Reflection.PropertyInfo reflecting the properties to be processed for DataForm item generation. |
System.Boolean | isAutogeneration | A |
Remarks
This method identifies properties that have not yet been included and generates DataForm items or groupings as appropriate. Use for dynamic DataForm construction.
Examples
protected override void OnInitialized()
{
GetAutogeneratedItems(typeof(Person).GetProperties().ToList());
}
OnInitializedAsync()
Initializes the FormItems component and notifies its parent SfDataForm instance that items are rendered.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task indicating the completion of initialization logic. |
Remarks
This method sets the IsFormItemsRendered
flag on its parent DataForm for proper rendering and lifecycle management.
Examples
await base.OnInitializedAsync();