Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (52 sloc) 2.38 KB
@page "/checkboxlist"
@using Radzen
@using NorthwindBlazor.Data
@using NorthwindBlazor.Models.Northwind
@using Microsoft.EntityFrameworkCore
@inject NorthwindContext dbContext
<h1 style="display:inline">CheckBoxList</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/CheckBoxListPage.razor" target="_blank">[source code]</a><a style="margin-left: 10px" href="https://www.radzen.com/documentation/blazor/checkboxlist/" target="_blank">[documentation]</a>
<p>This page demonstrates <b>CheckBoxList</b> component.</p>
<RadzenCard>
<div class="row">
<div class="col-md-6">
<h3>CheckBoxList with horizontal orientation</h3>
<RadzenCheckBoxList @bind-Value="values" TValue="int" Change="@((args) => Change(args, "CheckBoxList with horizontal orientation"))">
<Items>
<RadzenCheckBoxListItem Text="Orders" Value="1" />
<RadzenCheckBoxListItem Text="Employees" Value="2" />
<RadzenCheckBoxListItem Text="Customers" Value="3" />
</Items>
</RadzenCheckBoxList>
<br />
<h3>CheckBoxList with vertical orientation</h3>
<RadzenCheckBoxList @bind-Value="values" TValue="int" Orientation="Orientation.Vertical" Change="@((args) => Change(args, "CheckBoxList with vertical orientation"))">
<Items>
<RadzenCheckBoxListItem Text="Orders" Value="1" />
<RadzenCheckBoxListItem Text="Employees" Value="2" />
<RadzenCheckBoxListItem Text="Customers" Value="3" />
</Items>
</RadzenCheckBoxList>
<br />
</div>
<div class="col-md-6">
<h3>Events</h3>
<RadzenCard style="overflow: auto;height:500px;">
@foreach (var e in events.OrderByDescending(i => i.Key))
{
@e.Value
<br />
}
</RadzenCard>
</div>
</div>
</RadzenCard>
@code {
IEnumerable<int> values = new int[] { 1 };
Dictionary<DateTime, string> events = new Dictionary<DateTime, string>();
void Change(IEnumerable<int> value, string name)
{
var str = string.Join(", ", value);
events.Add(DateTime.Now, $"{name} value changed to {str}");
StateHasChanged();
}
}
You can’t perform that action at this time.