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

Expand PanelBarItem in the code-behind file

1 Answer 106 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Kranthi
Top achievements
Rank 1
Kranthi asked on 27 Aug 2009, 10:00 AM
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

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 27 Aug 2009, 04:43 PM
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.
Tags
PanelBar
Asked by
Kranthi
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or