DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

Button

in namespace DotVVM.Framework.Controls.Bootstrap

Extends the builtin Button control to allow applying Bootstrap CSS classes to the button.

Properties

Name Type Description Notes Default Value
ButtonTagName ButtonTagName Gets or sets whether the control should render the <input> or the <button> tag in the HTML.
attribute
inner element
static value
bindable
default
0
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
1
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
inner element
static value
bindable
default
Enabled Boolean Gets or sets a value indicating whether the button is enabled and can be clicked on.
attribute
inner element
static value
bindable
default
True
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
IsSubmitButton Boolean Gets or sets whether the control should render a submit button or a normal button (type="submit" or type="button"). The submit button has some special features in the browsers, e.g. handles the Return key in HTML forms etc.
attribute
inner element
static value
bindable
default
False
Size Size Gets or sets the size of the button.
attribute
inner element
static value
bindable
default
0
Text String Gets or sets the text on the button.
attribute
inner element
static value
bindable
default
Type BootstrapColor Gets or sets the color of the button.
attribute
inner element
static value
bindable
default
0
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description
Click Command Gets or sets the command that will be triggered when the button is clicked.

Usage & Scenarios

Extends the builtin Button control to allow applying Bootstrap CSS classes to the button and sizes.

http://getbootstrap.com/css/#buttons

HTML Rendered by the Control

Sample 1: Button Sizing

Use the Size property to set the size of the button.

<bs:Button Click="{command: DoSomething()}" 
           Text="Button" />

<bs:Button Click="{command: DoSomething()}" 
           Text="Button" 
           Size="Large" />

<bs:Button Click="{command: DoSomething()}" 
           Text="Button" 
           Size="Small" />

<bs:Button Click="{command: DoSomething()}" 
           Text="Button" 
           Size="ExtraSmall" />
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.Button.sample1
{
    public class ViewModel : DotvvmViewModelBase
    {

        public void DoSomething()
        {
        }
    }
}

Sample 2: Button Types

The Type property specifies the color of the button (using standard Bootstrap classes).

<bs:Button Click="{command: DoSomething()}"
           Text="Default"
           Type="Default" />

<bs:Button Click="{command: DoSomething()}"
           Text="Primary"
           Type="Primary" />

<bs:Button Click="{command: DoSomething()}"
           Text="Success"
           Type="Success" />
<bs:Button Click="{command: DoSomething()}"
           Text="Info"
           Type="Info" />

<bs:Button Click="{command: DoSomething()}"
           Text="Warning"
           Type="Warning" />

<bs:Button Click="{command: DoSomething()}"
           Text="Danger"
           Type="Danger" />
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.Button.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {

        public void DoSomething()
        {
        }
    }
}

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