John Threepwood
John Threepwood

Reputation: 16143

How to implement a horizontal scrollbar only for a subset of columns in a DataGrid?

Example: We have many columns and only want to scroll horizontally for the second column till last column.

| Name | Mail | Status | Location | ... many other columns ...
| Jon  | ...  | ...    | ...      | ...

Now we would like to 'fix' column Name and have a horizontal scrollbar beginning with column Mail ending at the last column.

| Name | Mail | Status | Location | ... many other columns ...
| Jon  | ...  | ...    | ...      | ...
       |<---  scrollbar here                              --->|

Is it possible to implement such a behavior with WPF?

Upvotes: 2

Views: 278

Answers (1)

Rachel
Rachel

Reputation: 132618

You should be able to use the FrozenColumnCount property of the DataGrid to specify the number of columns starting from the left that you want to "freeze" in place.

If you want to freeze any other columns that aren't the left-most ones though, you'll probably need to implement a custom behavior. :)

Upvotes: 2

Related Questions