Disable Scrolling for Panning in Grid

5 posts, 1 answers
  1. Alan
    Alan avatar
    4 posts
    Member since:
    Dec 2014

    Posted 02 Nov 2020 Link to this post

    Hi, How can I disable grid scrolling associated with a panning gesture? I would like it just to work when using the grid's scrollbar. So, while a user is panning, e.g. panning vertically up, I do not want the grid to scroll.

    Thanks!

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4080 posts

    Posted 03 Nov 2020 Link to this post

    Hi, Alan,

    Please set the RadGridView.EnableGestures property to false. In addition, make sure that the EnableKineticScrolling property is also set to false. Thus, you wouldn't scroll the view with moving the mouse with left button down.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  3. Alan
    Alan avatar
    4 posts
    Member since:
    Dec 2014

    Posted 03 Nov 2020 Link to this post

    Thanks for the reply! I need to handle panning but in a different way, other than scrolling. So, it needs to be enabled as a gesture. Is there a way  to disassociate scrolling from the panning or to override the behavior that panning has on the grid?

    Thanks again!

    Alan

  4. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4080 posts

    Posted 04 Nov 2020 Link to this post

    Hello, Alan, 

    If the pan gesture is enabled and you want to plug into the default logic, first make sure that the EnableKineticScrolling property is set to false. Thus, you will prevent the scrolling.

    Then, you can create a derivative of RadGridView and override its OnPanGesture method. There, you can introduce the desired logic you need.

    An alternative approach is to create a custom TableViewDefinition and override its CreateViewUIElement method where you can replace the default GridTableElement with a custom one: 
            public class CustomTableViewDefinition : TableViewDefinition
            {
                public override IRowView CreateViewUIElement(GridViewInfo viewInfo)
                {
                    return new CustomGridTableElement();
                }
            }
    
            public class CustomGridTableElement : GridTableElement
            {
                protected override Type ThemeEffectiveType     
                { 
                    get    
                    { 
                        return typeof(GridTableElement);     
                    }
                }
                 
                protected override void OnPanGesture(PanGestureEventArgs args)
                {
                    //TODO
                    base.OnPanGesture(args);
                }
            }
    Then, in the Designer.cs file replace the default TableViewDefinition with your custom one.

    Should you have further questions please let me know.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  5. Alan
    Alan avatar
    4 posts
    Member since:
    Dec 2014

    Posted 10 Nov 2020 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thank you Dess! That worked!

    Alan

Back to Top