Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@enchev @akorchev
46 lines (39 sloc) 2.05 KB
@page "/checkbox"
@using NorthwindBlazor.Data
@using NorthwindBlazor.Models.Northwind
@using Microsoft.EntityFrameworkCore
<h1 style="display:inline">CheckBox</h1><a style="margin-left: 10px" href="https://github.com/akorchev/blazor.radzen.com/blob/master/Pages/CheckBoxPage.razor" target="_blank">[source code]</a><a style="margin-left: 10px" href="https://www.radzen.com/documentation/blazor/checkbox/" target="_blank">[documentation]</a>
<p>This page demonstrates <b>CheckBox</b> component.</p>
<RadzenCard>
<div class="row">
<div class="col-md-6">
<h3>CheckBox</h3>
<RadzenCheckBox Name="CheckBox1" @bind-Value="@CheckBox1Value" Style="margin-bottom: 20px" TValue="bool" Change="@(args => Change(args, "CheckBox1 CheckBox"))" /><RadzenLabel Text="CheckBox1" Component="CheckBox1" Style="margin-left: 5px;margin-bottom: 20px" />
<br />
<RadzenCheckBox @bind-Value="CheckBox2Value" Name="CheckBox2" TriState="true" TValue="bool?" Change="@(args => Change(args, "TriState CheckBox"))" /><RadzenLabel Text="TriState" Style="margin-left: 5px;margin-bottom: 20px" Component="CheckBox2" />
<br />
<RadzenCheckBox Name="CheckBox3" Disabled="true" TriState="true" TValue="bool?" Change="@(args => Change(args, "Disabled CheckBox"))" /><RadzenLabel Text="Disabled" Style="margin-left: 5px;margin-bottom: 20px" Component="CheckBox3" />
<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 {
bool CheckBox1Value;
bool? CheckBox2Value;
Dictionary<DateTime, string> events = new Dictionary<DateTime, string>();
void Change(bool? value, string name)
{
events.Add(DateTime.Now, $"{name} value changed to {value}");
StateHasChanged();
}
}
You can’t perform that action at this time.