views:

26

answers:

1

I have a DataGrid wrapped in a ScrollViewer like this...

<ScrollViewer MaxHeight="600" VerticalScrollBarVisibility="Auto"
              BorderThickness="0" Padding="0">
    <sdk:DataGrid ItemsSource="{Binding BatchItems}" IsReadOnly="True">
        <sdk:DataGrid.Columns>
            <!-- Yada, yada, yada -->
        </sdk:DataGrid.Columns>
    </sdk:DataGrid>
</ScrollViewer>

It works fine and the scrollbar appears when it should. However, when I scroll it down, the DataGrid column headings move up and are no longer visible. I want to freeze the column headings so that when I scroll down I still know what I am looking at. How can this be done?

+2  A: 

Thanks to Michael Todd for the tips. I was able to do away with the ScrollViewer completely. The DataGrid has support for scrolling out of the box, evidently...

<sdk:DataGrid ItemsSource="{Binding BatchItems}" IsReadOnly="True"
              MaxHeight="600" VerticalScrollBarVisibility="Auto">
    <sdk:DataGrid.Columns>
        <!-- Yada, yada, yada -->
    </sdk:DataGrid.Columns>
</sdk:DataGrid>
Josh Stodola