New to Telerik UI for WPF? Download free 30-day trial

Styling or content mixed-up on scrolling

PROBLEM

Scenario 1

You have applied a Style for the GridViewCell or GridViewRow element. Then:

  1. Scroll so the first visual elements are out of view

  2. Scroll back to top of the GridView

  3. You will notice that the styles have mixed up

Scenario 2

You have applied a Template or set a Value for the GridViewCell element. Then:

  1. Scroll so the first visual elements are out of view

  2. Scroll back to top of the GridView

  3. You will notice that the cells' contents have mixed up

Scenario 3

Your Bindings are relying on RelativeSource or ElementName sources.

Scenario 4

You are creating a binding to GridViewCell.Value inside a DataTemplate.

CAUSE

Such problems are usually caused by directly working with the values of the rows/cells. Generally it is not a good practice to work with the visual elements of RadGridView as when the virtualization is enabled, then its rows and cells are reused. RadGridView uses same cells to display different values and your binding fails to update.

Please note that it is enabled by default. You may find more information about UI Virtualization in this help article.

SOLUTION

Use CellStyleSelector to set the style for the Cells and RowStyleSelector to set styles for the Rows

See Also

In this article