The problem is, when I edit programmatically column values in datagrid and scroll down, those values repeat in next cells of column which become visible. This seems like virtualization bug or "effect" since when I switch it off, problem disappears. I think the problem is in this place:
public void EditedCell(object oItem, string oColumnName, ref List<string> lErrors, object newValue = null)
{
DataGridRow dgRow = dgDati.ItemContainerGenerator.ContainerFromItem(oItem) as DataGridRow;
/* In other places, when I call EditedCell(DataGridRow, ...) it works fine.
The problem shows up only when I call EditedCell(object oItem, ...) */
EditedCell(dgRow, oColumnName, ref lErrors, newValue);
}
This is the screen of problem. Yellow cells are programmatically changed and other 0000 containing cells are shown due to this problem. When I read data from DataSource it doesnt have those 0000 values in DataRows:
Also to set value of cell, I set cell controls in cell and DataRow value to change value and display it properly:
if (oElement.GetType() == typeof(TextBox))
{
(oElement as TextBox).Text = newValue.ToString();
}
if (oElement.GetType() == typeof(TextBlock))
{
(oElement as TextBlock).Text = newValue.ToString();
}
Have anyone seen anything similar and knows how to deal with that?