RadzenDropDown Template Context Type

It would be really great if you could optionally specify the Template item type of a RadzenDropDown, it would allow me to get intellisense on binding data without conversions. Example:

   <RadzenDropDown @bind-Value="context.TeamId" Data="@viewModel.CompanyTeams.Where(c => c.CompanyId == viewModel.CompanyScenarios.FirstOrDefault(d => d.Id == context.ScenarioId)?.CompanyId)" TextProperty="@nameof(CompanyTeam.DisplayName)" ValueProperty="@nameof(CompanyTeam.Id)" Style="width:100%">
        <Template Context="dropDownContext">
            @((dropDownContext as CompanyTeam).Company?.CompanyName): @((dropDownContext as CompanyTeam).DisplayName)
        </Template>
    </RadzenDropDown>

As you can see, I'm having to do conversions to make sure a refactor breaks the build, versus just being able to specify and get what I need.

Thanks!

Hi @RobertMcLaws,

This would require the DropDown to have one additional generic parameter (TItem) and will probably become a breaking change. Still we will consider it for a future version of Radzen.

Out of curiosity, why would it require that the Dropdown have the TItem parameter? COuldn't it work like this?

   <RadzenDropDown @bind-Value="context.TeamId" Data="@viewModel.CompanyTeams.Where(c => c.CompanyId == viewModel.CompanyScenarios.FirstOrDefault(d => d.Id == context.ScenarioId)?.CompanyId)" ValueProperty="@nameof(CompanyTeam.Id)" Style="width:100%">
        <Template TItem="CompanyTeam" Context="dropDownContext">
            @(dropDownContext.Company?.CompanyName): @(dropDownContext.DisplayName)
        </Template>
    </RadzenDropDown>

I would think (but I'm not a Blazor components expert) that would allow you to continue to treat the context as a dynamic unless otherwise specified.

Thanks man! :facepunch:t2:

I don't think this would work. Just tried it and ended up with the following error:

Unrecognized attribute 'TItem' on child content element 'Template'.

As far as I know @typeparam works only for components and not child content properties such as the Template.