DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

ListGroupItem

in namespace DotVVM.Framework.Controls.Bootstrap

Represents an item in the ListGroup control.

Properties

Name Type Description Notes Default Value
Attributes Dictionary<String,Object>
attribute
inner element
static value
bindable
default
Badge String Gets or sets the text that appears in the badge. If the text is empty, no badge will be displayed.
attribute
inner element
static value
bindable
default
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
Static
Color ContextualColor Gets or sets the color of the list item. (Based on bootstrap list group styles.)
attribute
inner element
static value
bindable
default
Default
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
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
IsDisabled Boolean Gets or sets whether this item is disabled.
attribute
inner element
static value
bindable
default
False
IsSelected Boolean Gets or sets whether this item is selected.
attribute
inner element
static value
bindable
default
False
NavigateUrl String Gets or sets the URL of the item hyperlink.
attribute
inner element
static value
bindable
default
RouteName String Gets or sets the name of the route for the item hyperlink.
attribute
inner element
static value
bindable
default
Text String Gets or sets the text of the item.
attribute
inner element
static value
bindable
default
UrlSuffix String Gets or sets the suffix that will be appended to the generated URL.
attribute
inner element
static value
bindable
default
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

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

Usage & Scenarios

This control is used as a list item inside the ListGroup control.

The ListGroupItem derives from the ListItem and it adds several features to it specific for ListGroup.

HTML Rendered by the Control

Sample 1: Basic ListGroupItem

The ListGroupItem control contains Text property which displays text in the generated item.

The URL for link items can be specified using bindable NavigateUrl property.

You can specify the color of the item with the Color property using Bootstrap styling for items (Success, Info, Warning, Danger).

Additionally, you can add a badge text to the right side of the list item, using bindable Badge property. If this property is empty, empty badge will not be displayed.

<bs:ListGroup>
  <bs:ListGroupItem Text="Item 1" Color="Info" NavigateUrl="www.dotvvm.com"/>
  <bs:ListGroupItem Text="Item 2" Color="Success" Badge="This is success ListGroupItem" />
  <bs:ListGroupItem Text="Item 3" Color="Warning" />
  <bs:ListGroupItem Text="Item 4" Color="Danger" />
  <bs:ListGroupItem Text="Item 5" Badge="This is badge" />
</bs:ListGroup>

Sample 2: ListGroupItem - Item Types, Bindings & Other Properties

Similarly to Bootstrap each ListGroupItem can have different type. ItemType property specify what type of item will be generated. Expected values are Link which generates "a" element, Button which generates "button" element. Default generated element is "li".

Additionally the ListGroupItem control has the IsDisabled and IsSelected properties.

You can also use GlyphIcon or any other kind of HTML content inside the control.

<bs:ListGroup ItemType="Button">
  <bs:ListGroupItem Text="Item 1" Color="Info" />
  <bs:ListGroupItem Text="Item 2" Color="Success" IsDisabled="true" />
  <bs:ListGroupItem Text="Item 3" Color="Warning" IsSelected="true" />
  <bs:ListGroupItem Text="Item 4" Color="Danger" />
</bs:ListGroup>

<bs:ListGroup ItemType="Link">
  <bs:ListGroupItem Text="Google Link" NavigateUrl="https://www.google.com/" Color="Success"/>
  <bs:ListGroupItem Text="DotVVM" NavigateUrl="{value: BindedUrl}" />
</bs:ListGroup>

<bs:ListGroup>
  <bs:ListGroupItem Text="Item 1" Badge="Simple Badge" />
  <bs:ListGroupItem Color="Info">
    <bs:GlyphIcon Icon="Info_sign" /> info
  </bs:ListGroupItem>
  <bs:ListGroupItem Text="Item 3" Badge="{value: BadgeText}" />
  <bs:ListGroupItem IsDisabled="true">
    <bs:GlyphIcon Icon="Music" />
  </bs:ListGroupItem>
</bs:ListGroup>
using DotVVM.Framework.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.ListGroupItem.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string BadgeText { get; set; } = "Binded Badge Text From View Model";

        public string BindedUrl { get; set; } = "www.dotvvm.com";
    }
}

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