CheckBox
in namespace DotVVM.Framework.Controls.Bootstrap4
Extends the default CheckBox control with additional Bootstrap features.
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.3/components/forms/#checkboxes-and-radios
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.
Use the RenderLabel
property to set whether the label should be rendered.
If not set, the label will be rendered only when needed.
<bs:CheckBox Text="CheckBox default" Checked="{value: Checked1}" IsInline="true" />
<bs:CheckBox Text="CheckBox bootstrap custom" Checked="{value: Checked2}" FormControlStyle="BootstrapCustom" 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; }
}
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
Attributes | Dictionary<String,Object> |
attribute
static value
|
null | ||
Checked | Boolean? | Gets or sets whether the control is checked. |
attribute
bindable
|
False | |
CheckedItems | IEnumerable | Gets or sets a collection of values of all checked checkboxes. Use this property in combination with the CheckedValue property. |
attribute
static value
bindable
|
null | |
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
static value
bindable
|
null | |
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. |
attribute
bindable
|
null | |
Enabled | Boolean | Gets or sets a value indicating whether the control is enabled and can be clicked on. |
attribute
static value
bindable
|
False | |
FormControlStyle | CheckboxStyle | Gets or sets whether the control should use default or custom style. |
attribute
static value
|
Default | |
ID | String | Gets or sets the unique control ID. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
InnerText | String | Gets or sets the inner text of the HTML element. |
attribute
static value
bindable
|
null | |
IsInline | Boolean | Gets or sets whether there are more checkBoxes on the same line. |
attribute
static value
|
False | |
RenderLabel | Boolean? |
attribute
static value
|
null | ||
Text | String | Gets or sets the label text that is rendered next to the control. |
attribute
static value
bindable
|
||
Visible | Boolean | Gets or sets whether the control is visible. |
attribute
bindable
|
True |
Events
Name | Type | Description | |
---|---|---|---|
Changed | Command | Gets or sets the command that will be triggered when the control check state is changed. |