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

PanelBar selected/collapsed

1 Answer 54 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Frederic
Top achievements
Rank 1
Frederic asked on 09 May 2017, 06:06 PM

Searched forum and couldn't find a related issue. I'm using the PanelBar as Accordion. When a Panel bar item is selected it is displayed, but when the same panel bar item is selected agan it's collapsed. Can this behavior be prevented

If a panelbar item is already selected it stay selected and do not collapses. That means I want "ALWAYS" a panel bar item to be visible.

I'd rather prefer a XAML only solution.

Regards

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 11 May 2017, 10:50 AM
Hello Frederic,

I will post the answer from your support ticket also here in the forum.

"To achieve your requirement you can subscribe for the PreviewCollapsed event of the RadPanelBar control and handle it when all items are collapsing. Here is an example in code for this approach:

private void RadPanelBar_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    var panelBar = (RadPanelBar)sender;
    var areAllItemsCollapsing = panelBar.Items.OfType<RadPanelBarItem>().All(x => !x.IsExpanded);        
    e.Handled = areAllItemsCollapsing;
}
"

I am afraid that, I can't suggest you a XAML-only approach.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PanelBar
Asked by
Frederic
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or