Selected Item Data Binding

1 Answer 65 Views
PanelBar
Andrew
Top achievements
Rank 1
Iron
Iron
Andrew asked on 13 Nov 2023, 08:58 PM

Hello,

My use case requires me to be able to set the selected panel bar item programmatically. However, I don't see any data bindings or api methods on the control ref to set the selected panel. Is this possible?

Setting the private member SelectedItem through reflection appears to work. Are there implications to doing this that I should be aware of?

        PanelBarRef.GetType().InvokeMember("SelectedItem",
            BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.SetProperty | BindingFlags.Instance, 
            null, 
            PanelBarRef,
            new object[] { SelectedPage });

 

Thank You,

-Andy

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Nov 2023, 11:49 AM

Hi Andy,

This approach is not officially documented and supported, so we haven't tested it and cannot claim that it's reliable.

Alternatively, you can use OnItemRender and some custom CSS:

Select PanelBar item programmatically

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Tags
PanelBar
Asked by
Andrew
Top achievements
Rank 1
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or