Datagrid Horizontal scrollbar not visible

Apr 24, 2009 at 5:29 AM
Edited Apr 24, 2009 at 5:37 AM

Hi all.......

      I have the following datagrid

<

 

Window 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns
:x="http://schemas.microsoft.com/winfx/2006/xaml" 
x :Class="DataGrid.Window1"
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit" 
x
 
:Name="Window" 
Title="Window1" Width ="640" Height="480">
<Grid x:Name="LayoutRoot">

 

 

 

<dg:DataGrid  x:Name="DataGridControl" Width="300" Height="405" >
<dg:DataGrid.Columns>
<dg:DataGridTemplateColumn Header="column1"  Width="100"></dg:DataGridTemplateColumn>
<dg:DataGridTemplateColumn Header="column2" Width="100"></dg:DataGridTemplateColumn>
<dg:DataGridTemplateColumn Header="column3"  Width="100"></dg:DataGridTemplateColumn>
<dg:DataGridTemplateColumn Header="column4"  Width="371" ></dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>

 

 </

 

 

Window>


here the problem im facing is ,the fourth column named as "column4" is not visible as there is no horizontal scrollbar.

Can any one suggest a solution for this.

Thanks in Advance

 

 

 

 

Coordinator
Apr 24, 2009 at 9:59 PM
When there is no data in the grid, the scroll bar will not display. This is a known behavior of the grid. Once you add items to your ItemsSource, a scroll bar will appear.

Ben
Nov 16, 2010 at 4:33 AM

Hi Ben, Is it possible if I have to show horizontal scrollbar for datagrid having no datarows?

I want to provide scrollbar to scroll column headers even though there is no data in grid.

Thanks,

Rakesh

Sep 2, 2014 at 3:00 PM
rgunijan wrote:
Hi Ben, Is it possible if I have to show horizontal scrollbar for datagrid having no datarows? I want to provide scrollbar to scroll column headers even though there is no data in grid. Thanks, Rakesh
I'm facing the same problem (want to provide scrollbar to scroll column headers even though there is no data in grid).
Any suggestion?