可以调整列标题和行的高度,但我似乎不能找到一种让用户调整行标题宽度的方法。 我希望DataGrid以固定的行标题宽度大小打开,并让用户调整行头的宽度,如果他想要的话,但是没有调整大小的夹持器。
任何想法?
谢谢!
解决方案在线快速搜索后,我发现了两种实现您的要求的第一部分的方法。您可以使用固定的 RowHeader Width 打开 DataGrid ,如下所示:
< DataGrid ItemsSource ={Binding YourItems}RowHeaderWidth =100>或像这样:
< DataGrid ItemsSource ={Binding YourItems}> < DataGrid.RowHeaderStyle> < Style TargetType ={x:Type DataGridRowHeader}> < Setter Property =WidthValue =100/> < / Style> < /DataGrid.RowHeaderStyle> < / DataGrid>RowHeaderStyle 显然让我们设置更多的属性在 DataGridRowHeader ,但不幸的是,我找不到任何方式让用户自己调整大小。
I have a WPF DataGrid (System.Windows.Controls).
It is possible to resize columns headers, and rows height, but i can't seem to find a way to let the user resize the row headers width. I want the DataGrid to open with a fixed row header width size and let the user resize the width of the row header if he wants, but there is no resize gripper for this.
Any idea?
Thanks!
解决方案After a quick search online, I found two ways to achieve the first part of your requirement. You can open your DataGrid with a fixed RowHeader Width like this:
<DataGrid ItemsSource="{Binding YourItems}" RowHeaderWidth="100">Or like this:
<DataGrid ItemsSource="{Binding YourItems}"> <DataGrid.RowHeaderStyle> <Style TargetType="{x:Type DataGridRowHeader}"> <Setter Property="Width" Value="100" /> </Style> </DataGrid.RowHeaderStyle> </DataGrid>The RowHeaderStyle obviously let's us set more properties on the DataGridRowHeader, but unfortunately, I couldn't find any way to let the users resize it themselves.
更多推荐
在WPF DataGrid中调整行标题宽度的大小
发布评论