Freeze rows in DataGrid?

Aug 21, 2008 at 7:04 PM
I see that the WPF DataGrid supports freezing columns -- does it also support freezing rows? I am currently using the Infragistics WinGrid (not WPF) and it allows rows as well as columns to be "pinned" so that it would not scroll out of view. This feature is important to our users so I wanted to check before I dive into using the WPF Grid. Thanks!
Coordinator
Oct 2, 2008 at 11:15 PM
Sorry for the super delayed response.  Currently the WPF DataGrid does not support frozen rows.  There are a couple things that you can do to enable the scenario.  If you want to add a footer that is done through restyling the control template of the DataGrid.  Someone talks about their implementation of it on this thread, http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=36686.  If you want to support a scenario similar to excel where you can pin rows from the top down you will need to do a custom implementation of DataGridRowPresenter.ArrangeOverride.  I just finished a sample of that with the goal to minimize custom implementation and if you are interested I can post the solution.  The only problem with it is that it was not designed to work when the item container recycling feature is turned on.  To get it to work with recycling will require a good amount of reimplementation of the VirtualizingStackPanel's recycling code. 

So to sum up on this, you will be able to customize the DataGrid control for some frozen row scenarios but not for others without a big chunk of reimplementation.  This feature request has been noted by the feature team and will be considered for future versions of the DataGrid.
Oct 3, 2008 at 8:16 AM
I am desperately looking for a footer solution. Could you please be more specific as to how to do it with restyling? I just started to learn WPF and more often than not have no idea where to start.
thank you
Oct 9, 2008 at 5:44 PM
Vinsibal, I'm also very interested in this (Excel freeze pane) feature. I can live with it not using the container recycling for the time being (hoping though that it will get added in the future). What are your plans for sharing your code?
Oct 15, 2008 at 10:28 AM
joining the friends above - I'd also like to hear about a solution for freeze row.are there any plans to insert it into the DataGrid project?
Coordinator
Oct 31, 2008 at 9:52 PM
I just wrote a post that has a frozen row sample, http://blogs.msdn.com/vinsibal/archive/2008/10/31/wpf-datagrid-frozen-row-sample.aspx.