<SfDropDownList TItem="TItem" TValue="TValue" Value="@BindingValue" DataSource="@Data">
<DropDownListEvents TItem="TItem" TValue="TValue" ValueChange="@((args) => OnChange?.Invoke(args.Value))"></DropDownListEvents>
<DropDownListFieldSettings Text="@OptionDisplay" Value="@OptionValue" />
</SfDropDownList>
public partial class CustomSelectBox
{
[Parameter] public TValue BindingValue { get; set; } = default!;
[Parameter, EditorRequired] public string OptionDisplay { get; set; } = default!;
[Parameter, EditorRequired] public string OptionValue { get; set; } = default!;
[Parameter, EditorRequired] public IEnumerable Data { get; set; } = default!;
[Parameter] public Action? OnChange { get; set; }
}
<CustomSelectBox TItem="@int" TValue="@int?" Value="@Model.Year" Data="@YearRange" OptionDisplay="@(nameof(Model.Year))" OptionValue="@(nameof(Model.Year))" OnChange="@((value) => Model.Year = value)">
</CustomSelectBox>
There are
@typeparam TValue
@typeparam TItem
as well in the CustomSelectBox razor which your forum text editor for some reason deletes.
Based on the information you provided, we suspect that you are experiencing difficulty using the DropDownList as a custom component. You can refer to the Syncfusion forums shared below for assistance with your requirements.
Forums: