We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MoveDown event on scroll bar

Hi,

I am trying to attach an event handler to GridControl to catch a mouse down event on a scroll bar of the GridControl. I have tried MouseDown, GridControlMouseDown and ScrollControlMouseDown with no success. Could someone suggest a solution please?

Thanks!
Shaolin

3 Replies

AG Anish George Syncfusion Team May 18, 2016 06:46 AM UTC

Hi Shaolin, 

Thank you for using Syncfusion products. 

We request you to make use of the VerticalScroll and HorizontalScroll events for achieving this. Please refer the below code snippet. These events will be fired when the Scrollbar is clicked or moved. 

C#: 

this.gridControl1.VerticalScroll += gridControl1_VerticalScroll; 
void gridControl1_HorizontalScroll(object sender, ScrollEventArgs e) 
{ 
    // Required Code 
} 
 
this.gridControl1.HorizontalScroll += gridControl1_HorizontalScroll; 
void gridControl1_VerticalScroll(object sender, ScrollEventArgs e) 
{ 
    //Required Code 
} 

Please let us know if you need any further assistance. 

Regards,
Anish. 



SX Shaolin Xiong May 18, 2016 12:42 PM UTC

Hi Anish,

I am looking for MouseDown and MouseUp events on a scroll bar. I am sorry I mistakenly used a wrong word MoveDown for the subject and it should have been MouseDown.

Thanks,
Shaolin


AG Anish George Syncfusion Team May 19, 2016 10:37 AM UTC

Hi Shaolin,  

Thank you for your update. 

We regret to let you know that there is no separate event like MouseDown or MouseUp for scroll bars in GridControl. You can make use of the scroll events like HorizontalScroll, VerticalScroll, WindowScrolling, HScrollBar.Scroll, VScrollBar.Scroll etc and achieve your needs. But however you can make use of the custom scrollbar to achieve your requirement.  

You can make use of the ScrollerFrame control and assign this control to our GridControl scrollbar by using the AttachedTo property. Please refer the below code snippet. This custom scroll bar has the required MouseDown and MouseUp events. 

C#: 
ScrollersFrame scrollersFrame1 = new ScrollersFrame(); 
scrollersFrame1.AttachedTo = this.gridControl1; 
 
scrollersFrame1.HorizontalScroller.MouseDown += new MouseEventHandler(HorizontalScroller_MouseDown); 
scrollersFrame1.HorizontalScroller.MouseUp += new MouseEventHandler(HorizontalScroller_MouseUp); 
 
void HorizontalScroller_MouseUp(object sender, MouseEventArgs e) 
{ 
    // Required Code 
} 
 
void HorizontalScroller_MouseDown(object sender, MouseEventArgs e) 
{ 
    // Required Code 
} 


We have created a simple sample for your convenience. You can download it from here CustomScrollBar

Please let me know if you have any further concerns 

Regards, 
Anish. 


Loader.
Up arrow icon