<SfComboBox TValue="int?" TItem="VwActiveMatter" Width="300px" @bind-Value="@ComboVal" DataSource="@MattersList" Placeholder="---Please Select a Matter---" AllowFiltering=true>
<ComboBoxFieldSettings Value="MatterId" Text="CaseNumber"></ComboBoxFieldSettings>
<ComboBoxEvents TValue="int?" TItem="VwActiveMatter" OnValueSelect="ValueSelect" ValueChange="OnValueChange"></ComboBoxEvents>
</SfComboBox>
@code {
public int? ComboVal { get; set; }
public class VwActiveMatter
{
public int MatterId { get; set; }
public string CaseNumber { get; set; }
}
List<VwActiveMatter> MattersList = new List<VwActiveMatter> {
new VwActiveMatter() { MatterId= 1, CaseNumber= "12345" },
new VwActiveMatter() { MatterId= 2, CaseNumber= "6789" },
new VwActiveMatter() { MatterId= 3, CaseNumber= "2312" },
new VwActiveMatter() { MatterId= 4, CaseNumber= "3453" },
new VwActiveMatter() { MatterId= 5, CaseNumber= "5657" },
};
public void ValueSelect(SelectEventArgs<VwActiveMatter> args)
{
//Triggers when an item in the popup is selected by the user either with mouse / tap or with keyboard navigation.
}
public void OnValueChange(ChangeEventArgs<int?, VwActiveMatter> args)
{
//Triggers when an item in a popup is selected or when the model value is changed by user.
}
} |