Version: 2.0 |

CheckBox

in namespace DotVVM.Framework.Controls.Bootstrap4

Extends the default CheckBox control with additional Bootstrap features.

Properties

Name Type Description Notes Default Value
Checked Boolean? Gets or sets whether the control is checked.
attribute
inner element
static value
bindable
default
False
CheckedItems IEnumerable Gets or sets a collection of values of all checked checkboxes. Use this property in combination with the CheckedValue property.
attribute
inner element
static value
bindable
default
CheckedValue Object Gets or sets the value that will be used as a result when the control is checked. Use this property in combination with the CheckedItem or CheckedItems property.
attribute
inner element
static value
bindable
default
Enabled Boolean Gets or sets a value indicating whether the control is enabled and can be clicked on.
attribute
inner element
static value
bindable
default
False
FormControlStyle BootstrapFormStyle Gets or sets whether the control should use default or custom style.
attribute
inner element
static value
bindable
default
Default
IsInline Boolean Gets or sets whether there are more checkboxes on the same line.
attribute
inner element
static value
bindable
default
False
Text String Gets or sets the label text that is rendered next to the control.
attribute
inner element
static value
bindable
default

Events

Name Type Description
Changed Command Gets or sets the command that will be triggered when the control check state is changed.

Usage & Scenarios

Extends the builtin CheckBox control with Bootstrap CSS styles.

If you want to use this control inside ButtonGroup, use ButtonGroupCheckBox instead.

https://getbootstrap.com/docs/4.1/components/forms/#checkboxes-and-radios

HTML Rendered by the Control

Sample 1: Inline CheckBoxes

The IsInline property allows to render checkboxes on one row.

Use the FormControlStyle property to choose between browser default theme and Bootstrap custom theme.

<bs:CheckBox Text="CheckBox 1" Checked="{value: Checked1}" IsInline="true" />
<bs:CheckBox Text="CheckBox 2" Checked="{value: Checked2}" IsInline="true" />

<p>CheckBox 1: {{value: Checked1}}</p>
<p>CheckBox 2: {{value: Checked2}}</p>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.CheckBox.sample1
{
    public class ViewModel : DotvvmViewModelBase
    {
        public bool Checked1 { get; set; }
        public bool Checked2 { get; set; }
    }
}

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message