Editare

Partajați prin


Track.Thumb Property

Definition

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

public:
 property System::Windows::Controls::Primitives::Thumb ^ Thumb { System::Windows::Controls::Primitives::Thumb ^ get(); void set(System::Windows::Controls::Primitives::Thumb ^ value); };
public System.Windows.Controls.Primitives.Thumb Thumb { get; set; }
member this.Thumb : System.Windows.Controls.Primitives.Thumb with get, set
Public Property Thumb As Thumb

Property Value

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

Examples

The following example shows how the Thumb style is defined inside the ScrollBarControlTemplate when the Orientation property is Vertical.

<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>

Remarks

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 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.

    The following illustration shows a visual representation of some of these parameters in a ScrollBar control.

    Viewport size, thumb size, and track length

  • 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.

Applies to

See also