Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Freezing columns in wpf datagrid

Tags:

I have some tabular data which has a lot of fields in it, and when my WPF application is resized a lot of them are cut off. However, I want to see the first 6 columns always as they are important. How can I achieve this in a grid format? I am using the WPFToolkit DataGrid but can be persuaded to change to a different control if one exists.

Right now, I am using two different DataGrids side by side with the right most datagrid inside a scrollviewer with horizontal scrolling on and the vertical scrolling off. I will also have to either sync the two for sorting purposes or disable sorting altogether.

like image 868
Anthony Potts Avatar asked Dec 10 '09 15:12

Anthony Potts


People also ask

Is it possible to freeze the last column in WPF DataGrid?

EDIT: To clarify, it will still need to be the first column that is frozen, but it'll be frozen to the right side. Sorry, something went wrong. Sorry, something went wrong. I tried this alternative solution you have mentioned @miloush . Last column can be freezed.But then so many other issues are rising compared to normal WPF data-grid behavior.

How to set the number of frozen columns in a DataGrid?

Set the Datagrid's FrozenColumnCount = "1". Frozen columns are columns that are always displayed and cannot be scrolled out of visibility. Frozen columns are always the leftmost columns in display order. You cannot drag frozen columns into the group of unfrozen columns or drag unfrozen columns into the group of frozen columns.

How to freeze columns programmatically in radgridview?

You can freeze columns programmatically using the LeftFrozenColumnCount and RightFrozenColumnCount properties of RadGridView control. They are both numeric and you have to set them to the number of columns you wish to freeze. In Example 1, the first two columns are frozen starting from left to right.

How do I freeze a column in Excel?

To freeze a column on the left, the user has to drag the left frozen columns separator. Once there is a frozen column, you can freeze other columns by dragging their headers behind the frozen columns separator.


1 Answers

Okay, it's trivial in that control, all you have to do is set FrozenColumnCount = "6", in my case. Maybe someone else will need this and they can laugh at my stupidity.

like image 139
Anthony Potts Avatar answered Oct 25 '22 03:10

Anthony Potts