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

Scroll with the scrollbar per item not per pixel?

5 Answers 146 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 09 Mar 2017, 08:50 AM

Hi

Is it possible to scroll the TileView per item when I drag the vertical scroll bar? With many items per pixel scrolling is very slow.
If I use the mouse to scroll then the scrolling is per item which is what I want.

Regards.

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Mar 2017, 03:48 PM
Hello Ivo,

The scrolling of the RadTileView control is implemented via the native ScrollViewer control placed in the tileview's template. The ScrollViewer doesn't support the desired behavior, but you can implement it with custom logic. For example:
private void TileView_Loaded(object sender, RoutedEventArgs e)
{
    var scrollViewer = this.tileView.FindChildByType<ScrollViewer>();
    var thumb = scrollViewer.FindChildByType<Thumb>();        
    thumb.DragDelta += Thumb_DragDelta;           
}
 
private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
{
    var thumb = (Thumb)sender;
    var scrollViewer = thumb.ParentOfType<ScrollViewer>();
    if (the vertical change matches the size of the next visible element)           
    {
        scrollViewer.LineDown();
    }
    e.Handled = true;
}

Regards,
Martin
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tim
Top achievements
Rank 1
answered on 14 Mar 2017, 12:14 PM

Hi Martin

This line unfortunately returns null:

var thumb = scrollViewer.FindChildByType<Thumb>();

 

Do you show what is going on?

0
Martin Ivanov
Telerik team
answered on 15 Mar 2017, 11:31 AM
Hello Ivo,

It is possible that the Thumb from the ScrollViewer's template is not yet loaded in the Loaded event of the TileView control. You can try to get it in the Loaded event of the ScrollViewer as well.

Regards,
Martin
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tim
Top achievements
Rank 1
answered on 04 Apr 2017, 09:45 AM

I tried it in ScrollViewer Loaded event. Still doesn't work. Thumb can not be found.

Can you try this in an example on your machine?

BTW I'm using version Q3 2015 if it makes any difference.

0
Dinko | Tech Support Engineer
Telerik team
answered on 07 Apr 2017, 09:34 AM
Hello Ivo,

We have misled you in our previous reply. Basically, the suggested approach was for WPF and you marked this ticket for Silverlight. The reason why you can't find the Thumb and get null is that the Loaded event is fired too early and the control template is not yet updated. In this case, you can subscribe to the LayoutUpdate event of the RadTileView control.

As for your question, scrolling the tile view per item while dragging the thumb won't be an easy task. Basically, when you change the position of the thumb while dragging in order scroll per item the position of the mouse will not correspond to the thumb position and you will get unexpected behavior. An approach which you can try is to implement custom ScrollViewer where you can create custom logic to scroll the tile view per item using ScrollToVerticalOffset() method. As for the mouse, when the dragging operation starts you can hide the mouse cursor and show it again when you operation ends.

Regards,
Dinko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TileView
Asked by
Tim
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Tim
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or