RadPanelBar auto scroll to item using MVVM

1 Answer 49 Views
PanelBar
Nn
Top achievements
Rank 1
Nn asked on 10 Jan 2023, 09:47 AM

I cannot see any documentation or examples of how to scroll into a view items in a RadPanelBar. Are you able to provide an example of how to do this?

I've found a way to auto expand an item using <Setter Property="IsExpanded" Value="{Binding IsExpanded}" /> but this can expand an item which is still not visible and needs to be manually scrolled to. The IsSelected is similar but just seems to highlight that item and not scroll into view.

How can I auto scroll an item in the RadPanelBar into view using MVVM? Typically there may be approx 200 items but only 10 can be seen in view at any one time.

Code:


<telerik:RadPanelBar x:Name="radPanelBar1" Grid.Row="1" Width="500"
           HorizontalAlignment="Left" VerticalAlignment="Top"
           ItemTemplate="{StaticResource PanelBarHeaderTemplate}"
           ItemsSource="{Binding PanelBar1Items}"
           ExpandMode="Multiple">
      <telerik:RadPanelBar.ItemContainerStyle>
          <Style TargetType="telerik:RadPanelBarItem" BasedOn="{StaticResource RadPanelBarItemStyle}">
              <Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
          </Style>
      </telerik:RadPanelBar.ItemContainerStyle>
</telerik:RadPanelBar>

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 12 Jan 2023, 06:31 PM

Hello,

You can see how to scroll a RadPanelBarItem into the view in the following forum. The solution there is in code-behind, because some WPF control API should be used, but you can wrap this into some kind of custom behavior in case you want to avoid code-behind.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PanelBar
Asked by
Nn
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or