Skip to main content

DxUpload.SelectedFilesChanged Event

Fires when the file list changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v26.1.dll

Declaration

[Parameter]
public EventCallback<IEnumerable<UploadFileInfo>> SelectedFilesChanged { get; set; }

Parameters

Type Description
IEnumerable<UploadFileInfo>

A collection of UploadFileInfo objects that store information about files.

Remarks

Once a user selected or dropped a file, the Upload adds it to the file list. Users can then remove files from the list.

Upload Overview

The SelectedFilesChanged event occur each time the file list is changed (even if the ShowFileList property is set to false).

The following example handles this event and dynamically change the Upload’s Visible property. Use the ExternalSelectButtonCssSelector and ExternalDropZoneCssSelector properties to implement the external Select File button and drop zone container.

<div id="overviewDemoDropZone" class="card custom-drop-zone bg-light">
    <span class="drop-file-icon icon-margin"></span>
    <span>Drag and Drop File Here</span><span class="margin-style">or</span>
    <DxButton Id="overviewDemoSelectButton"
              CssClass="margin-style"
              RenderStyle="ButtonRenderStyle.Primary"
              Text="Select File" />
</div>

<DxUpload Name="myFile" UploadUrl="https://localhost:10000/api/Upload/Upload/" 
          Visible="@UploadVisible" 
          ExternalSelectButtonCssSelector="#overviewDemoSelectButton" 
          ExternalDropZoneCssSelector="#overviewDemoDropZone"
          ExternalDropZoneDragOverCssClass="custom-drop-zone-hover"
          SelectedFilesChanged="@SelectedFilesChanged">
</DxUpload>

@code {
    bool UploadVisible { get; set; } = false;

    protected void SelectedFilesChanged(IEnumerable<UploadFileInfo> files) {
        UploadVisible = files.ToList().Count > 0;
        InvokeAsync(StateHasChanged);
    }
}

Upload External UI

Run Demo: Upload - Overview

See Also