Bài đăng

Đang hiển thị bài đăng từ Tháng 10, 2023

Blazor Tri-State bool with checkbox

Hình ảnh
 Blazor Tri-State Boolean with checkbox A checkbox is a common way to represent a boolean variable. When the checkbox is checked, the variable is true. When it’s unchecked, the variable is false. Blazor includes a checkbox: <input type= "checkbox"  checked = "@isChecked"  @oninput= "CheckboxChanged" > However, in some cases, you might want more. You might want the boolean to be nullable because it is optional when you submit data to the server. The Radzen Tri-State checkbox handles this well. Here is a code example: < div class = "rz-p-12 rz-text-align-center" >     < RadzenCheckBox TriState = true @ bind -Value = @ value Name = "CheckBox3" />     < RadzenLabel Text = "CheckBox" Component = "CheckBox3" Style = "margin-left: 8px; vertical-align: middle;" /> </ div > @ code{     bool? value; } This is what the UI for the three states looks like: Note: Radzen Blazor is a f...