CollapsiblePanel

in namespace DotVVM.Framework.Controls.Bootstrap

Renders a Bootstrap collapsible panel.

Usage & Scenarios

A Bootstrap collapsible panel.

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

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;
        }
    }
}

Properties

Name Type Description Notes Default Value
property icon 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
null
property icon ContentTemplate ITemplate Gets or sets the content of the panel.
attribute
inner element
static value
bindable
default
null
property icon FooterTemplate ITemplate Gets or sets the contents of the panel footer.
attribute
inner element
static value
bindable
default
null
property icon HeaderTemplate ITemplate Gets or sets the contents of the panel header.
attribute
inner element
static value
bindable
default
null
property icon IsCollapsed Boolean Gets or sets whether the panel is collapsed or not.
attribute
inner element
static value
bindable
default
True
property icon RenderHeaderLink Boolean Gets or sets whether the header template is wrapped in hyperlink.
attribute
inner element
static value
bindable
default
True
property icon Type BootstrapColor Gets or sets the color of the panel header.
attribute
inner element
static value
bindable
default
Default

HTML produced by the control