在WPF中如何更改DataGrid.ScrollBar的宽度? [英] In WPF how to change the width of DataGrid.ScrollBar?
本文介绍了在WPF中如何更改DataGrid.ScrollBar的宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在WPF中,如何更改<code>
DataGrid.ScrollBar的宽度?
In WPF how to change the width of <code>
DataGrid.ScrollBar?
推荐答案
您需要为DataGrid创建自定义模板.在您的自定义模板中,您需要为ScrollViewer创建一个ControlTemplate,在其中您需要包含一个带有x:Name ="PART_VerticalScrollBar"的ScrollBar,并为其提供任意宽度.像这样:(仅模板的一部分)
You would need to make a custom Template for the DataGrid. In your custom template you need to create a ControlTemplate for the ScrollViewer, where you need to include a ScrollBar with x:Name="PART_VerticalScrollBar" and give it a width of whatever you like. Something like this:(only part of a template)
<ScrollBar x:Name="PART_VerticalScrollBar" Width="100" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
这篇关于在WPF中如何更改DataGrid.ScrollBar的宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文