Click here to Skip to main content
13,192,426 members (47,443 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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">
                 <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" />
                 <Style TargetType="{x:Type DataGridColumnHeader}">
                     <Setter Property="Control.Background" Value="#FF35496A" />
Posted 17-Jan-13 18:08pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171017.2 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100