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

RadPanelBar, SelectedItem and Expansion not working correctly

1 Answer 180 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
klogand
Top achievements
Rank 1
klogand asked on 31 May 2011, 10:34 PM
I have ViewModel and a View. The View has the RadPanelBar and the bar's ItemSource is a collection of
containers(to handle the hierarchical data template). I'm also binding the SelectedItem to the view model's
CurrentPanelBarContainer. I was expecting the CurrentPanelBarContainer to be the one that is expanded, but
it is not. What's the correct way to get this working?

<
telerikNavigation:RadPanelBar AutomationProperties.AutomationId="zonesPanelBar" x:Name="zonesPanelBar" VerticalAlignment="Stretch" Margin="5"
                                          ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                          ItemsSource="{Binding PanelBarZoneContainers}"
                                          SelectedItem="{Binding CurrentPanelBarContainer, Mode=TwoWay}"
                                          IsSingleExpandPath="True" ExpandMode="Single">
           <telerikNavigation:RadPanelBar.ItemTemplate>
              <telerik:HierarchicalDataTemplate ItemsSource="{Binding Path=ZonesForTab}">
                 <!-- ZonesForTab are PanelBarZoneContainerViewModel -->
                 <!-- MouseLeftButtonDown="templateZoneHeaderStackPanel_MouseLeftButtonDown" -->
                 <StackPanel x:Name="templateZoneHeaderStackPanel" Orientation="Horizontal">
                    <Border Visibility="{Binding ZoneExtender.IsRootZone, Converter={StaticResource InverseVisibilityConverter}}" Background="Black" Height="17" Width="17" BorderThickness="1" CornerRadius="4" Margin="3,0,0,0">
                       <Border.BorderBrush>
                          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                             <GradientStop Color="Black" Offset="0"/>
                             <GradientStop Color="#FFCCCCCC" Offset="1"/>
                          </LinearGradientBrush>
                       </Border.BorderBrush>
                       <Border Background="{Binding ZoneExtender.ColorKey}" Visibility="Visible" Margin="2" CornerRadius="2"/>
                    </Border>
                    <TextBlock Style="{StaticResource W11ArialTextBlock}" FontWeight="{Binding ZoneExtender.IsRootZone, Converter={StaticResource BooleanToFontBoldConverter}}" Text="{Binding ZoneExtender.ZoneName, Mode=TwoWay}" Margin="6,0,0,0"/>
                 </StackPanel>
                 <telerik:HierarchicalDataTemplate.ItemTemplate>
                    <DataTemplate>
                       <views:ZonePropertiesTabView />
                    </DataTemplate>
                 </telerik:HierarchicalDataTemplate.ItemTemplate>
              </telerik:HierarchicalDataTemplate>
           </telerikNavigation:RadPanelBar.ItemTemplate>
        </telerikNavigation:RadPanelBar>

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 02 Jun 2011, 11:59 AM
Hi klogand,

Yes, the behavior you have come up with is expected. Binding the SelectedItem property of the RadPanelBar or binding the IsSelected property of the RadPanelBarItem will only select the item. In order to be expanded you have to bind also the IsExpanded property of the RadPanelBarItem via ContainerBindings. Please let us know if you need further assistance ont this.

Best wishes,
Petar Mladenov
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
Tags
PanelBar
Asked by
klogand
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or