bugged87
bugged87

Reputation: 3142

DataGrid Row Details Visibility

I'm using a DataGrid control with the RowDetailsTemplate property defined. Obviously, clicking on a row will display the row details for that row. However, once the row details are displayed then I have a problem when scrolling downwards in the DataGrid. As soon as the row whose details are visible moves up and out of view, then the row details vanish instantly causing the following rows to "jump" up and fill the space. Scrolling upwards again causes the row details to appear instantly causing the following rows to "jump" back down to provide the space.

This does not seem be a virtualization problem because the same behavior occurs no matter what the value of EnableRowVirtualization. Also, I understand that from the perspective of a visual tree this makes sense since the row details container is within the row container. However, the behavior just looks visually silly in practice.

Is there anyway to keep the row details always visible, even if the actual row is not visible, until the row is deselected?

Upvotes: 1

Views: 1180

Answers (1)

coonal
coonal

Reputation: 93

Set ScrollViewer.CanContentScroll attached property on the DataGrid to "False". This will allow smooth scrolling of the DataGrid items along with its RowDetails. But this can impact performance as the Virtualization functionality of the DataGrid will not be used.

Upvotes: 1

Related Questions