Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-customize-the-thumb-size-on-a-scrollbar.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.1 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Customize the Thumb Size on a ScrollBar 03/30/2017
ScrollBar control [WPF]
customizing thumb size [WPF]
thumb size [WPF]
fa32b866-5ca1-4e73-85e7-2ac64b80d194

How to: Customize the Thumb Size on a ScrollBar

This topic explains how to set the xref:System.Windows.Controls.Primitives.Thumb of a xref:System.Windows.Controls.Primitives.ScrollBar to a fixed size and how to specify a minimum size for the xref:System.Windows.Controls.Primitives.Thumb of a xref:System.Windows.Controls.Primitives.ScrollBar.

Example

Description

The following example creates a xref:System.Windows.Controls.Primitives.ScrollBar that has a xref:System.Windows.Controls.Primitives.Thumb with a fixed size. The example sets the xref:System.Windows.Controls.Primitives.Track.ViewportSize%2A property of the xref:System.Windows.Controls.Primitives.Thumb to xref:System.Double.NaN and sets the height of the xref:System.Windows.Controls.Primitives.Thumb. To create a horizontal xref:System.Windows.Controls.Primitives.ScrollBar with a xref:System.Windows.Controls.Primitives.Thumb that has a fixed width, set the width of the xref:System.Windows.Controls.Primitives.Thumb.

Code

[!code-xamlScrollBarCustomThumbSize#1]

Description

The following example creates a xref:System.Windows.Controls.Primitives.ScrollBar that has a xref:System.Windows.Controls.Primitives.Thumb with a minimum size. The example sets the value of xref:System.Windows.SystemParameters.VerticalScrollBarButtonHeightKey%2A. To create a horizontal xref:System.Windows.Controls.Primitives.ScrollBar with a xref:System.Windows.Controls.Primitives.Thumb that has a minimum width, set the xref:System.Windows.SystemParameters.HorizontalScrollBarButtonWidthKey%2A.

Code

[!code-xamlScrollBarCustomThumbSize#2]

See also