Scroll with the scrollbar per item not per pixel?

6 posts, 0 answers
  1. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 09 Mar Link to this post

    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.

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1475 posts

    Posted 13 Mar Link to this post

    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.
  3. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 14 Mar in reply to Martin Ivanov Link to this post

    Hi Martin

    This line unfortunately returns null:

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

     

    Do you show what is going on?

  4. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1475 posts

    Posted 15 Mar Link to this post

    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.
  5. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 04 Apr in reply to Martin Ivanov Link to this post

    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.

  6. Dinko
    Admin
    Dinko avatar
    462 posts

    Posted 07 Apr Link to this post

    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.
Back to Top