RadGallery doesn't scroll to selected item

2 posts, 0 answers
  1. Andreas
    Andreas avatar
    3 posts
    Member since:
    Nov 2010

    Posted 11 Dec 2012 Link to this post


    if i fill a RadGalleries ItemsSource with my DataObjects and create a ItemTemplate in XAML and i select a item
    in the PopUpMenu, the scrollviewer don't scroll to the item in the Gallery.
    The PopUpMenu is scolled correctly.

    I use the SelectionChanged event to use the ScrollHost to use ScrollIntoView(SelectedItem) but it don't scroll to it.

    My ItemTemplate is ja Grid with a Image and a TextBlock with Converter.

    Is this a bug or is something wrong with the scroller?

  2. Kiril Vandov
    Kiril Vandov avatar
    323 posts

    Posted 14 Dec 2012 Link to this post

    Hello Andreas,

    Using that technique to scroll the selected item in the SelectionChangedEvent works at our side, but it does not position the item at the top of the RadRibbonGallery. However there is another way to scroll the selected item as desired using the ItemHeight and the SelectedIndex, here is a code snipped showing hot to achieve that:
    private void xRadGalery_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        int selectedItemIndex = this.xRadGalery.SelectedIndex;
        var scrollViewer = this.xRadGalery.ChildrenOfType<ScrollViewer>().Last();
        if (selectedItemIndex > 0)
            scrollViewer.ScrollToVerticalOffset(xRadGalery.ItemHeight * selectedItemIndex);
    I hope this information helps.

    All the best,
    Kiril Vandov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top