)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to avoid AutoScroll behavior in WinForms XPTaskBar when control is selected?

Platform: WinForms |
Control: XPTaskbar |
Published Date: April 14, 2016 |
Last Revised Date: February 6, 2020

Avoid AutoScroll behavior

XPTaskBar is a container control, which displays Scrollbar when its child items bound exceeds its bounds. As like in Panel, when a child control is selected in XPTaskBar it will be Auto scroll and bring the selected control into view. This behaviour can be resolved by following below steps.

1. Need to create Custom control, which is derived from XPTaskBar.

2. Need to override its ScrollToControl function and maintain its scroll position.

C#

protected override System.Drawing.Point ScrollToControl(System.Windows.Forms.Control activeControl)
{
   // Returning the current location prevents the XPTaskBar from
   // scrolling to the active control when the panel loses and regains focus
   return this.AutoScrollPosition;  
}

VB

Protected Overrides Function ScrollToControl(ByVal activeControl As System.Windows.Forms.Control) As System.Drawing.Point
   ' Returning the current location prevents the XPTaskBar from
   ' scrolling to the active control when the panel loses and regains focus
    Return Me.AutoScrollPosition
End Function

      

Avoid XPTaskBar to scroll automatically with image

Figure 1. Avoid XPTaskBar to scroll automatically with image.

Samples:

C#:How to avoid XPTaskBar to scroll automatically C#

VB: How to avoid XPTaskBar to scroll automatically VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon