Freezing columns is just one of the many things you can do with the Silverlight DataGrid. Read more about the features that the Silverlight 2 DataGrid has to offer...

Freezing Columns

Have you ever been working with a large enough number of columns that you get horizontal scrolling, but you want some of the columns to not scroll?  Think of a column such as Employee Name that you want to remain visible while you scroll through ten weeks of sales data.  You might want to see which employee had the best sales for week 4.  Since the Employee column is on the far left, any amount of scrolling causes it to scroll out of view, that is unless you freeze it.  This causes it to not scroll and always be visible putting your other data in context.


To freeze columns, you simply set the FrozenColumnCount property on the DataGrid to the number of columns you want to freeze.  For instance, to freeze the Employee column pictured above, you would write:


employeeSalesGrid.FrozenColumnCount = 1;


EmployeeSalesGrid.FrozenColumnCount = 1


If you are programmatically working with a column and want to know if it is frozen or not, you can check the IsFrozen property on the Column.  This is a readonly property that will let you know if the column you are working with is frozen.