Export (0) Print
Expand All

Track.Thumb Property

Gets the Thumb control that is used to change the Value of a Track.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public Thumb Thumb { get; set; }
/** @property */
public Thumb get_Thumb ()

/** @property */
public void set_Thumb (Thumb value)

public function get Thumb () : Thumb

public function set Thumb (value : Thumb)

<object>
  <object.Thumb>
    <Thumb .../>
  </object.Thumb>
</object>

Property Value

The Thumb control that is used with the Track. The default value is a Thumb control that has default settings.

The placement of the Thumb control corresponds to the Value of the Track control. The size of the Thumb control in a Track control reflects the amount of content that is currently visible.

The following illustrations show a Thumb in a Track inside a ScrollViewer control. The size of the scrollable content is the same for both examples. However, in the second example, the size of the Thumb control is larger because more of the content is visible.

Short scroll bar

ScrollBar screen shot

The size of the Thumb control of the Track is computed in the following ways:

  • If the ViewportSize property is not specified, the size of the Thumb is a fixed default value. This is how the Thumb of a Track functions inside a Slider control.

  • If the ViewportSize property is specified and the size of the content is greater than the ViewportSize, the following formula is used:

ThumbSize = TrackLength * ViewportSize/(Maximum - Minimum + ViewportSize)

Where the parameters are defined as follows:

ThumbSize

The size of the Thumb control in the same units as the TrackLength.

TrackLength

The length of the Track.

ViewportSize

The size of the scrollable area that is visible in the content units, such as the number of pages of a document.

Maximum

The maximum value of the content in content units, such as page 10 of a 10-page document.

Minimum

The minimum value of the content in content units, such as page 1 of a document.

  • If the size of the content is less than a ViewportSize, the Thumb does not appear and the Visibility property of Thumb is set to false.

The minimum sizes for a Thumb control are determined by two system parameters, VerticalScrollBarButtonHeight and HorizontalScrollBarThumbWidth. The minimum size for a Thumb control in a vertical Track is 1/2* VerticalScrollBarButtonHeight and the minimum size for a Thumb control in a horizontal Track is 1/2* HorizontalScrollBarThumbWidth.

The following example shows how the Thumb style is defined inside the ScrollBarControlTemplate when the Orientation property is Vertical. For the complete sample, see Custom ScrollBar Template Sample.

<Track Grid.Row="1" Name="PART_Track"
       IsDirectionReversed="true">
  <Track.DecreaseRepeatButton>
    <RepeatButton Style="{DynamicResource ScrollBar_UpTrack}"/>
  </Track.DecreaseRepeatButton>
  <Track.Thumb>
    <Thumb Style="{DynamicResource ScrollBar_HorizontalThumb}"/>
  </Track.Thumb>
  <Track.IncreaseRepeatButton>
    <RepeatButton Style="{DynamicResource ScrollBar_DownTrack}"/>
  </Track.IncreaseRepeatButton>
</Track>

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

Community Additions

ADD
Show:
© 2014 Microsoft