Please help me to understand why this doesn't work (does compile, any errors are just from pulling this snippet out):
@using Syncfusion.Blazor.DropDowns;
<table>
<tr>
<td>
Project:
</td>
<td>
<SfComboBox AllowCustom="false" TValue="ProjectType?" TItem="ProjectType" @bind-Value="@selectedProjectType" DataSource="@ProjectTypes">
<ComboBoxFieldSettings Text="Text"></ComboBoxFieldSettings>
</SfComboBox>
</td>
</tr>
</table>
@code {
protected ProjectType? selectedProjectType;
protected class ProjectType
{
public int Id { get; set; } = 0;
public string Text { get; set; } = "";
public int Points { get; set; } = 0;
public override string ToString()
{
return Text;
}
}
protected List<ProjectType> ProjectTypes = new List<ProjectType>()
{
new ProjectType() { Id = 1, Text = "Large Medical Hospital", Points = 10},
new ProjectType() { Id = 2, Text = "Small Medical Hospital/Clinic", Points = 10},
new ProjectType() { Id = 3, Text = "Commercial Office New", Points = 10},
new ProjectType() { Id = 4, Text = "Commercial Office Remodel", Points = 10},
new ProjectType() { Id = 4, Text = "School", Points = 10},
};
protected override void OnInitialized()
{
base.OnInitialized();
}
}
Gives an exception when a selection is made: