Automatically expand the panelbar

4 posts, 0 answers
  1. Sathish
    Sathish avatar
    1 posts
    Member since:
    Dec 2011

    Posted 15 Dec 2011 Link to this post

    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..

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 20 Dec 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Trish
    Trish avatar
    6 posts
    Member since:
    Oct 2011

    Posted 03 Jan 2012 Link to this post

    The ContainerBindingCollection is only available in Silverlight.  How would you do it in WPF?
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 06 Jan 2012 Link to this post

    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 >>

Back to Top