How do I freeze DataGrid's Columns?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I would like to know if anyone knows how to implement the funcionality of freezing columns of a datagrid (like in excel for eg.)

Thanks
 
Hi RV,

A DataColumn has a ReadOnly property which will effectively "freeze" the
data, but it will look like a regular column in the datagrid.

Happy coding!
Morten
 
Thanks for your answer
But, what I would like to do I is to get the entire column freezed when I scroll the datagrid, so that it will always stay visible
 
I have no idea, and have never done anyting like this, but my first guess
would be two datagrids. Morph the appearance so it looks like one and the
first one (frozen columns) will not move.......


RV said:
Thanks for your answer.
But, what I would like to do I is to get the entire column freezed when I
scroll the datagrid, so that it will always stay visible.
 
I'm trying do follow that way but it has several problems, as how to keep a normal navigation or cell actualization between the two grids. I'd like to know if there is other way...
 
Hi I think that if you want to freeze columns in .net DataGrid control you must override GridHScrolled and in dependence of direction of scrolling - hide or show columns with ColumnIndex with is greater than "freezing" columns. In this way you will have columns that is on the screen always when the Grid is Scrolled.

FreeStyle557
 
Hi

I have the same problem... I've put together a dataset, that contains a random (often large) amount of coulumns, and I would as weel like to freeze the first of them..

A possible way is to split your dataset over 2 datagrids and remove the rowHeaders - this will make it appear that some of the columns are frozen, but it's a lot of work

Let me know if you come up with a solution
 
Back
Top