Version: 2.0 |

RadioButton

in namespace DotVVM.Framework.Controls.Bootstrap4

Extends the default RadioButton 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
CheckedItem Object Gets or sets the CheckedValue of the first RadioButton that is checked and bound to this collection.
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
GroupName String Gets or sets an unique name of the radio button group.
attribute
inner element
static value
bindable
default
IsInline Boolean Gets or sets whether there will be more radio buttons 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 RadioButton control with Bootstrap CSS styles.

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

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

HTML Rendered by the Control

Sample 1: Inline RadioButtons

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:RadioButton Text="RadioButton 1" GroupName="RadioButtons" 
                CheckedValue="RadioButton 1" CheckedItem="{value: Radio}" 
                IsInline="true" />
<bs:RadioButton Text="RadioButton 2" GroupName="RadioButtons" 
                CheckedValue="RadioButton 2" CheckedItem="{value: Radio}"
                IsInline="true" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.RadioButton.sample1
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string Radio { 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