menu

Blazor

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

    Show / Hide Table of Contents

    Class Template

    Inheritance
    System.Object
    Template
    Namespace: Syncfusion.Blazor.DataForm
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class Template : OwningComponentBase

    Constructors

    Template()

    Declaration
    public Template()

    Properties

    ChildContent

    Gets or sets the content to be rendered inside the associated FormItem within the data form.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    A Microsoft.AspNetCore.Components.RenderFragment representing the template fragment rendered as the body of the FormItem. The default value is null.

    Remarks

    This property allows you to provide custom content or UI components that will be injected within the FormItem context. Typical usage includes defining forms, layouts, and editors for structured data forms in Blazor components.

    Examples

    The following example demonstrates how to define a custom template using the ChildContent property:

    <FormItem Field="@nameof(SampleModel.Value)">
        <Template>
            <InputText @bind-Value="@SampleModel.Value" class="e-input" />
        </Template>
    </FormItem>

    Methods

    Dispose()

    Releases all resources used by the Template component.

    Declaration
    public virtual void Dispose()
    Remarks

    This method should be called when the component is no longer needed, to ensure that all resources are appropriately disposed and memory is freed. Invokes Dispose(Boolean) with true parameter to perform resource cleanup.

    Examples

    The following demonstrates how to dispose the template component manually:

    var template = new Template();
    template.Dispose();

    Dispose(Boolean)

    Disposes the resources (managed and unmanaged) used by the Template component.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Remarks

    This method is called from Dispose() to free resources held by this component and to nullify references for garbage collection. Override this method in a derived class to customize disposal logic.

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    System.Threading.Tasks.Task
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved