menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class FormItems - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class FormItems

    Represents the template and logic for automatically generating form items in a Syncfusion DataForm component.

    Inheritance
    System.Object
    FormItems
    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 bool indicating whether to perform standard dispose logic.

    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 bool flag indicating whether autogeneration is enabled. The default value is false.

    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();
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved