This is a migrated thread and some comments may be shown as answers.

Custom GridView Column Cells are Swapping Sporadically on Scroll

0 Answers 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 20 May 2011, 03:43 PM
The way I am currently binding to the GridView is via the DataTable control defined here: blogs.telerik.com/vladimirenchev/posts/09-04-23/lightweight_datatable_for_your_silverlight_applications.aspx .

I have created a custom column using the example here: http://www.telerik.com/help/silverlight/gridview-add-button-column.html

I am binding the data to my controls via the post and thread here: http://www.telerik.com/community/forums/silverlight/gridview/binding-a-custom-cell-to-the-underlying-data-source.aspx#1592841

The issue I am having is that when I scroll my grid horizontally or vertically and the cell.Content is NOT null in the following code:
public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem)
{
FrameworkElement ele = base.CreateCellElement(cell, dataItem);
if (cell.Content != null)
{
return (FrameworkElement)cell.Content;
}
return CreateHeaderControl(cell, dataItem);
}

The cell and the dataItem do not always appear to by related to one another. What ends up happening is the wrong cell ends up at a Row/Column index. This happens sporadically and seemingly swaps cells at random.

I have a sample project I can send you that illustrates this error. I tried to attach it to this post but realized you could only attach images.

My sample has a grid with 20 Columns and 5 Rows with a constantly iterating integer value for each cell. I have set it up so that it has a scroll bar. If you scroll back and forth very quickly you will shortly see that the values start to randomly fall out of order, the cells swapping with one another. The cell swap is made clear by the fact that custom controls in the third column are all disabled, shortly the disabled controls will swap across random Row/Column indexes.

Is there something I am doing in wrong in my code that is causing this functionality or is this a legitimate issue? I've followed all the provided examples and support as closely as I could to produce this grid, and I am still having this problem.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Andrew
Top achievements
Rank 1
Share this question
or