Thumb Class

Represents a control that lets the user drag and resize controls.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public class Thumb : Control
/** @attribute LocalizabilityAttribute(LocalizationCategory.NeverLocalize) */ 
public class Thumb extends Control
public class Thumb extends Control

The Thumb control lets the user change the value of a control, such as a ScrollBar or Slider control.

The following illustration shows a Thumb control that is part of a ScrollBar control.

Scrollbar illustration

The Thumb control provides the infrastructure to resize controls. For example, a Thumb control in the corner of a window can provide a location for the user to click with the mouse to start a resize operation.

Thumb provides DragStarted, DragCompleted and DragDelta events to manage drag operations associated with the mouse pointer. These events are used to provide drag functionality for a Thumb in a Slider and ScrollBar control.

When the user presses the left mouse button, the Thumb control receives logical focus and mouse capture, and the DragStarted event is raised. While the Thumb control has focus and mouse capture, the DragDelta event can be raised multiple times without limit. When the user releases the left mouse button, the Thumb control loses mouse capture and the DragCompleted event is raised. The event information provides a change in position, but does not reposition the Thumb. You must manually change or reposition the Thumb or any other elements that you want to resize or change as a result of the drag operation.

The Thumb control does not provide drag-and-drop functionality.

A Thumb control can receive mouse capture, but cannot receive keyboard focus. Therefore, the IsKeyboardFocused property that corresponds to keyboard focus is set to false. This value overrides the parent class Control that sets this property to true.

When a Thumb is part of a Track control that scrolls content in a viewable area or viewport, the size of the Thumb reflects the size of the viewport. For more information, see the Track class.

To provide drag capability, class handling is provided for the MouseLeftButtonDown, MouseLeftButtonUp and MouseMove events. For more information, see the OnMouseLeftButtonDown, OnMouseLeftButtonUp and OnMouseMove methods.

<Thumb Name="myThumb" Canvas.Left="80" Canvas.Top="80" Background="Blue" 
      Width="20" Height="20" DragDelta="onDragDelta" 
      DragStarted="onDragStarted" DragCompleted="onDragCompleted"


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0