Class FormItems
Represents the template and logic for automatically generating form items in a Syncfusion DataForm component.
Inherited Members
Namespace: Syncfusion.Blazor.DataForm
Assembly: Syncfusion.Blazor.dll
Syntax
public class FormItems : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
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 |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Dispose(bool)
Releases the resources used by the FormItems component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | A |
Overrides
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>, bool)
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 |
|---|---|---|
| List<PropertyInfo> | properties | A list of PropertyInfo reflecting the properties to be processed for DataForm item generation. |
| bool | 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 |
|---|---|
| Task | A Task indicating the completion of initialization logic. |
Overrides
Remarks
This method sets the IsFormItemsRendered flag on its parent DataForm for proper rendering and lifecycle management.
Examples
await base.OnInitializedAsync();