I have a MVVM scenario where my data includes the header and isexpanded
ie
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}"> |
<telerikNavigation:RadPanelBarItem.Header> |
<TextBlock Text="{Binding HeaderName}" Margin="5 4 5 5" /> |
</telerikNavigation:RadPanelBarItem.Header> |
<TextBlock Text="{Binding Content}"/> |
</telerikNavigation:RadPanelBarItem> |
</Controls:HierarchicalDataTemplate> |
<telerikNavigation:RadPanelBar BorderBrush="#9098a3" BorderThickness="1" Margin="5" |
ItemsSource="{Binding Path=PanelData}" |
ItemTemplate="{StaticResource MyTemplate}"> |
</telerikNavigation:RadPanelBar> |
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