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

IsExpanded Question

1 Answer 75 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Steve asked on 20 Apr 2010, 08:26 PM
I have a MVVM scenario where my data includes the header and isexpanded
PanelData = new ObservableCollection<Sample> 
                                new Sample {HeaderName = "Panel1", Content="Hello Panel1", IsExpanded = false}, 
                                new Sample {HeaderName = "Panel2", Content="Hello Panel2", IsExpanded = true

In the xaml, I have the following:
<Controls:HierarchicalDataTemplate x:Key="MyTemplate"
                <telerikNavigation:RadPanelBarItem  IsExpanded="{Binding IsExpanded}"> 
                        <TextBlock Text="{Binding HeaderName}" Margin="5 4 5 5" /> 
                    <TextBlock Text="{Binding Content}"/> 
<telerikNavigation:RadPanelBar BorderBrush="#9098a3" BorderThickness="1" Margin="5" 
                                           ItemsSource="{Binding Path=PanelData}" 
                                             ItemTemplate="{StaticResource MyTemplate}"

The problem is that it's creating a panel within a panel on each item:

See attached.  I have tried several ways but cannot figure out how to control the IsExpanded piece without ending up with this scenario.  Otherwise, I wouldn't add the RadPanelBarItem in the template.  All other ways have failed me so far though.

Thank you

1 Answer, 1 is accepted

Sort by
Miro Miroslavov
Telerik team
answered on 23 Apr 2010, 09:49 AM
Hello Steve,

In order to bind Sample.IsExpanded property to RadPanelBarItem.IsExpanded you have to use ContainerBinding technique.You can read more about it here. The example is with TreeView but it's the same in your case.
If you have further questions please ask us.

All the best,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Share this question