Expanding RadPanelBarItem Programmatically

2 posts, 1 answers
  1. Sam
    Sam avatar
    19 posts
    Member since:
    May 2009

    Posted 30 Nov 2009 Link to this post

    I have a RadPanelBar that I create programmtically on initial load.  I am able to tell it which RadPanelBarItem is expanded or not at this time, and this works as expected.

    I have a requirement where I have a button and when I click on it, it will expand the last RadPanelBarItem and collapse the other RadPanelBarItems, if it is open.  I can't get seem to get it to expand or collapse once it is opened.

    Any help would be appreciated.

    I am setting the IsExpanded Property of RadPanelBarItem and it does not chance after setting. I've tried the following:

    foreach (RadPanelBarItem panelBarItem in PanelBar.Items) {
    panelBarItem.IsExpanded = false;
    }
    ((RadPanelBarItem )PanelBar.Items.Last()).IsExpanded = 
    true;

    foreach
     (RadPanelBarItem panelBarItem in PanelBar.Items) {
    panelBarItem.SetValue(RadPanelBarItem.IsExpandedProperty, true)
    }
    ((RadPanelBarItem )PanelBar.Items.Last()).SetValue(RadPanelBarItem.IsExpandedProperty, true);
  2. Answer
    Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 30 Nov 2009 Link to this post

    Hi Sam,

    I prepared a sample project which demonstrates how to collapse all items and expand the last one when a button is clicked. Please take a look at it and let me know if it helps.

    Best wishes,
    Tihomir Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top