Class UploaderTemplates
Inheritance
Namespace: Syncfusion.Blazor.Inputs
Assembly: Syncfusion.Blazor.dll
Syntax
public class UploaderTemplates : OwningComponentBase
Constructors
UploaderTemplates()
Declaration
public UploaderTemplates()
Properties
Template
Gets or sets the template used to render custom content for uploaded files in the SfUploader component.
Declaration
public RenderFragment<FileInfo> Template { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment<FileInfo> | A Microsoft.AspNetCore.Components.RenderFragment<> of type FileInfo that defines the custom template content. The default value is |
Remarks
This property allows you to define a custom template for displaying uploaded files in the uploader component. The template receives a FileInfo context object that contains information about the uploaded file. When this property is set, the template will be applied to each file item in the uploader's file list.
Examples
The following example demonstrates how to use a custom template for file display:
<SfUploader>
<UploaderTemplates>
<Template>
<div class="custom-file-item">
<span>@context.Name</span>
<span>(@context.Size bytes)</span>
</div>
</Template>
</UploaderTemplates>
</SfUploader>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
OnInitializedAsync()
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous initialization operation. |
Remarks
This method is called once during the component's lifecycle, after the component has been constructed and has received its initial set of parameters. It registers the template with the parent SfUploader component if a template is provided.