Library Blazor Components ListBox Reference Classes ListBox SelectedItem

SelectedItem

Identifies a currently selected item (if any). This property supports two-way binding.

razor
[Parameter]
public T? SelectedItem { get; set; }

Example

razor
<ListBox T="string" ItemsSource="Countries" @bind-SelectedItem="SelectedCountry">
</ListBox>

<p>Currently selected country is: @SelectedCountry</p>

@code {
    private string? SelectedCountry;
}

Sign in