DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

CollapsiblePanel

in namespace DotVVM.Framework.Controls.Bootstrap

Renders a Bootstrap collapsible panel.

Properties

Name Type Description Notes Default Value
AdditionalContentTemplate ITemplate Gets or sets the additional content of the panel. This template is used to place a list group and other content without the padding inside the panel.
attribute
inner element
static value
bindable
default
Attributes Dictionary<String,Object>
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
ContentTemplate ITemplate Gets or sets the content of the panel.
attribute
inner element
static value
bindable
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
FooterTemplate ITemplate Gets or sets the contents of the panel footer.
attribute
inner element
static value
bindable
default
HeaderTemplate ITemplate Gets or sets the contents of the panel header.
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
IsCollapsed Boolean Gets or sets whether the panel is collapsed or not.
attribute
inner element
static value
bindable
default
True
RenderHeaderLink Boolean Gets or sets whether the header template is wrapped in hyperlink.
attribute
inner element
static value
bindable
default
True
Type BootstrapColor Gets or sets the color of the panel header.
attribute
inner element
static value
bindable
default
Default
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description

Usage & Scenarios

A Bootstrap collapsible panel.

https://getbootstrap.com/docs/3.3/javascript/#collapse

HTML Rendered by the Control

Sample 1: Simple Collapsible Panel

Use the HeaderTemplate and ContentTemplate properties to specify the header and the main content of the panel.

Optionally, you can use the FooterTemplate and AdditionalContentTemplate to specify the footer and additional content of the panel.
The additional content is intended to use the ListGroup control since it doesn't have any padding around the content.

The Type property allows to specify the color of the panel header.

<bs:CollapsiblePanel Type="Danger">
  <HeaderTemplate>
    Header
  </HeaderTemplate>
  <ContentTemplate>
    Content
  </ContentTemplate>
  <FooterTemplate>
    Footer
  </FooterTemplate>
  <AdditionalContentTemplate>
    <bs:ListGroup>
      <bs:ListGroupItem Text="ListGroup" />
      <bs:ListGroupItem Text="ListGroup" />
    </bs:ListGroup>
  </AdditionalContentTemplate>
</bs:CollapsiblePanel>

Sample 2: Collapsible Panel State Binding

The IsCollapsed property gets or sets, whether the panel is currently collapsed.

<bs:CollapsiblePanel IsCollapsed="{value: Collapsed1}">
  <HeaderTemplate>
    Collapsible Panel with Type binding
  </HeaderTemplate>
  <ContentTemplate>
    This is the panel body.
  </ContentTemplate>
</bs:CollapsiblePanel>
<bs:CollapsiblePanel IsCollapsed="{value: Collapsed2}">
  <HeaderTemplate>
    Collapsible Panel with Type binding
  </HeaderTemplate>
  <ContentTemplate>
    This is the panel body.
  </ContentTemplate>
</bs:CollapsiblePanel>

<p>First panel: {{value: Collapsed1}}</p>
<p>Second panel: {{value: Collapsed2}}</p>

<p><dot:Button Text="Collapse All" Click="{command: CollapseAll()}" /></p>
using DotVVM.Framework.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.CollapsiblePanel.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public bool Collapsed1 { get; set; }

        public bool Collapsed2 { get; set; }

        public void CollapseAll()
        {
            Collapsed1 = true;
            Collapsed2 = true;
        }
    }
}

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