Method 1: rewrite the attributes of the systemparameters class.
The width parameter of the WPF scroll bar is stored in the verticalscrollbarwidthkey and horizontalscrollbarheightkey attributes of systemparameters. It is easy to define a dynamic resource to change this parameter within its range.
<Scrollviewer horizontalscrollbarvisibility = "Auto"
Xmlns: SYS = "CLR-namespace: system; Assembly = mscorlib">
<Scrollviewer. Resources>
<SYS: Double X: Key = "{X: static systemparameters. verticalscrollbarwidthkey}"> 100 </sys: Double>
<SYS: Double X: Key = "{X: static systemparameters. horizontalscrollbarheightkey}"> 100 </sys: Double>
</Scrollviewer. Resources>
<Button width = "400" Height = "400"> AAA </button>
</Scrollviewer>
Method 2: Define a style
Define a style for the scrollbar class in scrollviewer, so that the corresponding attributes of the scrollbar in scrollviewer will be set
<Scrollviewer horizontalscrollbarvisibility = "Auto">
<Scrollviewer. Resources>
<Style targettype = "{X: Type scrollbar}">
<Style. triggers>
<Trigger property = "orientation" value = "horizontal">
<Setter property = "width" value = "Auto"/>
<Setter property = "height" value = "100"/>
</Trigger>
<Trigger property = "orientation" value = "vertical">
<Setter property = "width" value = "100"/>
<Setter property = "height" value = "Auto"/>
</Trigger>
</Style. triggers>
</Style>
</Scrollviewer. Resources>
<Button width = "400" Height = "400"> AAA </button>
</Scrollviewer>
The results are the same after the two operations: