Expand PanelBarItem in the code-behind file

2 posts, 0 answers
  1. Kranthi
    Kranthi avatar
    15 posts
    Member since:
    May 2009

    Posted 27 Aug 2009 Link to this post

    Hello Telerik,

    I am using RadPanelBar in one of my application, Now i need to expand one of the panelbaritems from one of my function in the code-behind.

    for example i need to expand the third item in panel bar when i click on a button.

    Consider I am binding a list of "Car" objects to a panelbar, now when i am looping through the items of panelbar i am getting each car item.. 

    In this case how to i expand the "n-th" item of panelbar..
    expecting a solution asap...

    thanks,
    - Kranthi
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 27 Aug 2009 Link to this post

    Hello Kranthi,

    Every ItemsControl has ItemContainerGenerator. An ItemContainerGenerator is responsible for generating the user interface (UI) for its data item. Therefore if you want to expand a certain item from a RadPanelBar, you can do the following:

    private void Button_Click(object sender, RoutedEventArgs e) 
        RadPanelBarItem container = panelBar1.ItemContainerGenerator.ContainerFromItem(panelBar1.Items[2]) as RadPanelBarItem; 
        container.IsExpanded = true

    I am attaching a sample project for further reference. Give it a try and let me know how it works for you.

    Regards,
    Kiril Stanoev
    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. UI for WPF is Visual Studio 2017 Ready
Back to Top