需要帮助调整datagrid标头 [英] Need help in adjusting datagrid header

查看:66
本文介绍了需要帮助调整datagrid标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我设计了一个数据网格,标题颜色为蓝色,背景为白色,带有垂直滚动条。

但问题是当我正确启用滚动条时,在右侧顶角的那个时间由于滚动条而出现一个空间。标题不覆盖整个区域..



请告诉我如何弥补这个差距。

以下是我的xaml代码:



Hi all

I have designed one datagrid with header color as blue,background as white and with a vertical scroll bar.
but the problem is when i m enabling the scroll bar properly to visible, that time at the right side top corner one space is coming due to that scroll bar.the header is not covering the total area..

please tell me how to cover that gap.
below is my xaml code:

<DataGrid AlternatingRowBackground="#64BDC6D7" AlternationCount="2" AreRowDetailsFrozen="False" AutoGenerateColumns="False" Background="White" BorderBrush="Navy" CanUserAddRows="True" Canvas.Left="15" Canvas.Top="203" ClipboardCopyMode="IncludeHeader" ColumnHeaderHeight="20" EnableColumnVirtualization="True" FontSize="10" Foreground="White" GridLinesVisibility="All" HeadersVisibility="All" Height="107" HorizontalGridLinesBrush="#64BDC6D7" Name="DataGrid1" OverridesDefaultStyle="False" Rowremoved="White" RowDetailsVisibilityMode="Visible" SelectionMode="Extended" SelectionUnit="Cell" SnapsToDevicePixels="False" UseLayoutRounding="True" Width="592" VerticalGridLinesBrush="Navy" VerticalScrollBarVisibility="Visible" RowHeaderWidth="100" CanUserResizeRows="False">
             <DataGrid.Columns>
                 <DataGridTextColumn Header="" Width="20
                                     " />
                 <DataGridTextColumn Header="Billdate" Width="50" />
                 <DataGridTextColumn Header="Bill No" Width="50" />
                 <DataGridTextColumn Header="Bill Amount" Width="70" />
                 <DataGridTextColumn Header="Due days" Width="60" />
                 <DataGridTextColumn Header="Due Date" Width="50" />
             </DataGrid.Columns>
             <DataGrid.Resources>
                 <Style TargetType="{x:Type DataGridColumnHeader}">
                     <Setter Property="Control.Background" Value="#FF35496A" />
                 </Style>
             </DataGrid.Resources>
         </DataGrid>

推荐答案

这是预期的行为。标题是它们所在列的宽度。如果你想要更宽的标题,你会把列的内容放在垂直滚动条下面并且在它之上,因为整个内容不再是100%可见的,你会得到一个水平滚动条交叉到底部网格。



是否真的需要填充标题的宽度?
That''s the expected behavior. The headers are the widths of the columns they sit over. If you want the header wider, you''ll put the contents of the column under the vertical scrollbar and on top of that, since the entire contents are no longer 100% visible, you''ll get a horizontal scroll bar acrossed the bottom of the grid.

Is it really that neccessary to fill the width of the header?


这篇关于需要帮助调整datagrid标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆