I need some help because I'm stuck with the horizontal scrollbar in the datagrid.
I have a TabControl and I've add a DataGrid to a TabItem, the problem is the Horizontal ScrollBar is never visible, even if I set ScrollViewer.HorizontalScrollBarVisibility="Visible" or if I put the DataGrid in a Grid
<TabControl Margin="6,0,6,0" >
<TabItem>
<DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" IsReadOnly="True" HorizontalAlignment="Center" VerticalAlignment="Center" SelectionMode="Extended">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding BlaBla}" Header="BlaBlaBla" />
...
</DataGrid.Columns>
</DataGrid>
</TabItem>
...
Can someone help me to point the problem? Thanks.
Edit :
Here is a sample code that reproduce the same problem, the vertical scrollbar is showing correctly but not the horizontal scrollbar
Xaml:
<Window x:Class="BlaBla.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<DataGrid Name="datagrid" ItemsSource="{Binding}" AutoGenerateColumns="False" IsReadOnly="True" HorizontalAlignment="Center" VerticalAlignment="Center" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Date}" Header="Date" />
<DataGridTextColumn Binding="{Binding Path=User}" Header="User"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
Code-behind :
datagrid.DataContext = this.SomeDataTable;
It doesn't work if I do <ScrollViewer HorizontalScrollBarVisibility="Visible"> around the controls
<ScrollViewer HorizontalScrollBarVisibility="Visible" Width="50">around the controls do you get a scrollbar?.. Oh also, set the width of the inner control to like 200 for this test. - safetyOtter