Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows WPF VB.NET
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>
Posted 17-Jan-13 19:08pm

1 solution

Rate this: bad
good
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?
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2014
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