Hi,
is it possible to integrate a button in each element in the dropdowlist ? I would like to choose an element and in the click of this button launch an action. This button will be construct dynamically.
Thanks
Hi,
is it possible to integrate a button in each element in the dropdowlist ? I would like to choose an element and in the click of this button launch an action. This button will be construct dynamically.
Thanks
You can use Template to define such:
<RadzenDropDown @bind-Value=@value Data=@customers
TextProperty="@nameof(Customer.CompanyName)"
ValueProperty="@nameof(Customer.CustomerID)" Style="width: 400px;">
<Template>
@{ var customer = (Customer)context; }
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.SpaceBetween">
@customer.CompanyName
<RadzenButton Icon="@customer.ActionIcon" Text="@customer.ActionText"
Size="ButtonSize.ExtraSmall" Variant="Variant.Flat"
Click="@(args => RunAction(customer))"
@onclick:stopPropagation="true" />
</RadzenStack>
</Template>
</RadzenDropDown>
@code {
async Task RunAction(Customer customer)
{
// your action here
}
}