Accordion control region

Topics: Prism v2 - Silverlight 3
Jan 29, 2010 at 3:39 PM


I am trying to use the accordion control as a region in a similar fashion to the tab control. The accordion control derives from the ItemsControl and so out the box allows the region manager to register numerous views with the region. This works and basically creates the accordion header and content sections and inserts the views into the content part of the accordion items.

The part I am struggling with is how to get the header value of the accordion items bound to one of the ViewModel properties. With a tab control you could use the following code to do the binding:


<controls:TabControl Name="tabControl1" Regions:RegionManager.RegionName="ToolboxRegion">
    <Style TargetType="controls:TabItem">
      <Setter Property="HeaderTemplate">
            <TextBlock Text="{Binding MyViewName}" />


Usually in an accordion control you would use something like this:


<layoutToolkit:Accordion Name="accordionControl1" Regions:RegionManager.RegionName="ToolboxRegion">
      <TextBlock Text="{Binding MyViewName}"></TextBlock>


I guess there is no way for the binding to figure out how to use the region manager to bind the correct values. Is there something I am missing or do I need to create a custom region adapter for the accordion control. Anybody have any ideas?






Feb 2, 2010 at 1:01 PM

Hi James,

As you said, you need to create a new RegionAdapter to be able to modify the item’s style. Take into account that as there is already an adapter for the ItemsControl, you could inherit from it and add the required functionality.

Please let me know if this helps.

Damian Schenkelman


Feb 4, 2010 at 11:18 AM

Hi Damian,

Thanks for the advice and link to the article, will investigate - cheers james