Freezing columns on right

Jan 7, 2009 at 2:09 PM
Hi,

The DataGrid doesn't appear to allow you to freeze columns on the right-hand-side. They are always on the left. Are there any existing examples/guidance out there about freezing columns on the right? I've had a look through the code base and it would appear to be a fair chunk of work.

Thanks,
Kent
Coordinator
Jan 7, 2009 at 7:32 PM

Hi Kent,

You're right - it’s fairly complicated to implement a frozen column on the right side.  To do it, you’d have to:

 

·         Subclass DataGrid to add new properties like RightFrozenColumnCount (if you wanted to freeze more than one column)

·         Subclass DataGridCellsPanel and override ‘MeasureOverride’ and ‘ArrangeOverride’ methods to arrange cells accordingly (this is probably the biggest part of the problem). One has to note that this is the class which has most of the implementation for column virtualization (and most of hidden columns) too which makes it more difficult.

·         Subclass DataGridColumnHeadersPresenter to modify the end user column reordering to account for right frozen columns.

·         Retemplate/restyle DataGrid to account for above changes

·         Retemplate DataGrid to position horizontal scroll bar appropriately

·         There might be other small changes

As far as I know, I don't believe there are any samples of this implemented available at this time (if you write one, please share!).  You're not the first to make this request, so this is a feature that we will consider adding in a future release.  However, it definitely won't be in .NET 4.0, so it will likely be a while before an official solution is available.  We apologize for the inconvenience - unfortunately we just couldn't fit all of the features we wanted in V1.  If you do come across a sample or guidance, please post a link to it here so that other developers can use it also.

Thanks!
Samantha

Jan 8, 2009 at 10:12 AM
OK, thanks for the prompt reply Samantha.

Best,
Kent