RadPanelBar, SelectedItem and Expansion not working correctly

2 posts, 0 answers
  1. klogand
    klogand avatar
    6 posts
    Member since:
    Oct 2012

    Posted 31 May 2011 Link to this post

    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">
                  <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">
                              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                 <GradientStop Color="Black" Offset="0"/>
                                 <GradientStop Color="#FFCCCCCC" Offset="1"/>
                           <Border Background="{Binding ZoneExtender.ColorKey}" Visibility="Visible" Margin="2" CornerRadius="2"/>
                        <TextBlock Style="{StaticResource W11ArialTextBlock}" FontWeight="{Binding ZoneExtender.IsRootZone, Converter={StaticResource BooleanToFontBoldConverter}}" Text="{Binding ZoneExtender.ZoneName, Mode=TwoWay}" Margin="6,0,0,0"/>
                           <views:ZonePropertiesTabView />
  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 02 Jun 2011 Link to this post

    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
Back to Top