DataGrid ScrollViewer with static Header

Dec 29, 2008 at 6:18 AM
Hi,

What is the best way to add a scrollviewer to a DataGrid. I've tried the below way..

<ScrollViewer Grid.Row="1" Grid.Column="0" Height="Auto" MaxHeight="200">
            <Grid>
                <Grid.RowDefinitions>                
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <wpftk:DataGrid Name="debugDataGrid"    
                            Grid.Row="0"
                            Margin="3"      
                            RowHeight="25"
                            VerticalContentAlignment="Center"    
                            HorizontalGridLinesBrush="LightSlateGray"
                            VerticalGridLinesBrush="LightSteelBlue"
                            BorderThickness="1"
                            HeadersVisibility="Column">
                </wpftk:DataGrid>
            </Grid>  
        </ScrollViewer>

The problem I've with this method is, the Header row is also scrolling. Is there anyway to implement scrolling with static Header?

Thanks,
Dec 29, 2008 at 6:33 AM
Edited Dec 30, 2008 at 3:31 AM
Hi,

I solved the issue :-)

 Initially I tried to use ScrollViewer.IsDeferredScrollingEnabled Property of the DataGrid. But it didn't work. Anyway the it was my mistake, scrolling is not working without setting the Height property of the DataGrid.

 Thanks!