RadioButton

in namespace DotVVM.Framework.Controls.Bootstrap

Extends the default RadioButton control with additional Bootstrap features.

Usage & Scenarios

Extends the builtin RadioButton control with an option to set Bootstrap CSS classes and support of the ButtonGroup.

https://getbootstrap.com/docs/3.3/css/#forms-controls

Sample 1: Inline RadioButtons

The IsInline property allows to render checkboxes on one row.

If the RadioButtons are placed inside the ButtonGroup control, they are set to inline by default so you don't have to change anything.

<bs:RadioButton Text="RadioButton 1" GroupName="RadioButtons" 
                CheckedValue="RadioButton 1" CheckedItem="{value: Radio}" 
                Inline="true" />
<bs:RadioButton Text="RadioButton 2" GroupName="RadioButtons" 
                CheckedValue="RadioButton 2" CheckedItem="{value: Radio}"
                Inline="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; }
    }
}

Sample 2: RadioButton in ButtonGroup

You can change the color of the RadioButton using the Type property.

This property works only inside the ButtonGroup control.

<bs:ButtonGroup>
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 1" 
                  CheckedItem="{value: Radio}" Text="RadioButton - Default" 
                  Type="Default" />
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 2"  
                  CheckedItem="{value: Radio}" Text="RadioButton - Primary"  
                  Type="Primary" />
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 3"  
                  CheckedItem="{value: Radio}" Text="RadioButton - Success"  
                  Type="Success" />
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 4"  
                  CheckedItem="{value: Radio}" Text="RadioButton - Info"  
                  Type="Info" />
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 4"  
                  CheckedItem="{value: Radio}" Text="RadioButton - Warning"  
                  Type="Warning" />
  <bs:RadioButton GroupName="RadioButtons" CheckedValue="RadioButton 4"  
                  CheckedItem="{value: Radio}" Text="RadioButton - Danger"  
                  Type="Danger" />
</bs:ButtonGroup>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.RadioButton.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string Radio { get; set; }
    }
}

Properties

Name Type Description Notes Default Value
property icon Checked Boolean Gets or sets whether the control is checked.
attribute
inner element
static value
bindable
default
False
property icon 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
null
property icon 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
null
property icon 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
property icon GroupName String Gets or sets an unique name of the radio button group.
attribute
inner element
static value
bindable
default
property icon IsInline Boolean Gets or sets whether there will be more radio buttons on the same line. When this property is true, the radio button gets the Boostrap "inline" CSS class.
attribute
inner element
static value
bindable
default
False
property icon Text String Gets or sets the label text that is rendered next to the control.
attribute
inner element
static value
bindable
default
property icon Type BootstrapColor Gets or sets the Bootstrap color.
attribute
inner element
static value
bindable
default
Default

Events

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

HTML produced by the control