This is a migrated thread and some comments may be shown as answers.

Automatically expand the panelbar

3 Answers 172 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Sathish
Top achievements
Rank 1
Sathish asked on 15 Dec 2011, 04:27 PM
Hi,

I am new to using Telerik controls
 
Requirement
  • I am having two header panel (Customer,Salary)
  • under that many items are displaying without any issue
  • i want to collapse/expand the Customer header panel and it's items as a default selection when the page is loaded. 

For More details please see the attached image the Breverage header should be automatically collapsed like that i need...

      
How to acheive this.
My code is as below

<HierarchicalDataTemplate x:Key="availablePresetsTemplate" ItemsSource="{Binding Values}"
                                            ItemTemplate="{StaticResource presetTemplate}">          
<TextBlock Text="{Binding Path=Name}"/>            
</HierarchicalDataTemplate>
  
<telerik:RadPanelBar 
            x:Name="panelBar"
            Grid.Column="0" Grid.Row="1"            
            SelectionMode="Extended"
           IsLoadOnDemandEnabled="True"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            ItemsSource="{Binding AvailableRoles}"
            ItemTemplate="{StaticResource availablePresetsTemplate}"
            HorizontalAlignment="Stretch"/>

 

Thanks in Advance..

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 20 Dec 2011, 03:18 PM
Hi Sathish,

As I managed to understand you need to have particular Items in the RadPanelBar selected and expanded initially. In its core, the RadPanelBar inherits from RadTreeView, so you can take advantage of the telerik's ContainerBindingCollection and bind the IsExpanded and/or IsSelected properties of the RadPanelBarItem / RadTreeViewItem to boolean properties from your ViewModels. Please check out this help article showing how to achieve this. 

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Trish
Top achievements
Rank 1
answered on 04 Jan 2012, 12:29 AM
The ContainerBindingCollection is only available in Silverlight.  How would you do it in WPF?
0
Petar Mladenov
Telerik team
answered on 06 Jan 2012, 09:14 AM
Hello Trish,

 Please excuse me for providing a Silverlight tips instead of WPF's ones. In WPF, you use Style Bindings like so:

<Style x:Key="ItemContainerStyle" TargetType="{x:Type telerik:RadTreeViewItem}">
    <Setter Property="IsSelected" Value="{Binding Path=Selected}"/>
    <Setter Property="IsExpanded" Value="{Binding Path=Expanded}"/>
</Style>
The following hep article is analogŠ¾us to the mentioned SL's one.
On a side note, please also keep in mind that Style bindings are now possible in Silverlight 5. 

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
PanelBar
Asked by
Sathish
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Trish
Top achievements
Rank 1
Share this question
or