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

RadGallery doesn't scroll to selected item

1 Answer 32 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 11 Dec 2012, 01:03 PM
Hello,

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?

thanks

1 Answer, 1 is accepted

Sort by
0
Kiril Vandov
Telerik team
answered on 14 Dec 2012, 09:21 AM
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.

Tags
RibbonView and RibbonWindow
Asked by
Andreas
Top achievements
Rank 1
Answers by
Kiril Vandov
Telerik team
Share this question
or