I am trying to use RowReorder code provided by Telerik, which is working fine in normal case. But when
I am grouping the Grid, the code provided is simply not working. Following is the code block which
actually takes care of Reordering of Rows in "OnDropInfo"...
else if (e.Options.Status == DragStatus.DropComplete && gridView != null)
{
IList items = gridView.ItemsSource as IList;
GridViewRow row = this.AssociatedObject.ItemContainerGenerator.ContainerFromItem
(this.currentDropItem) as GridViewRow;
DropPosition dropPosition = this.GetDropPositionFromPoint(e.Options.CurrentDragPoint,
row);
int index = 0;
if (row != null)
{
index = items.IndexOf(row.Item);
if (dropPosition == DropPosition.After)
{
index++;
}
if (index < 0)
{
index = 0;
}
}
foreach (object draggedItem in draggedItems)
{
items.Insert(index, draggedItem);
}
}
Problem here is the ItemSource dosent have knowledge of Row Index in grid after Grouping..which I can get using GridView.Items property but when I am trying to insert using "GridView.Items.Insert(index, object)", its throwing the "InvalidOperationException" with Follwing Message...
"Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."
Please let me know how I can handle the scenario of using RowReorderBehavior with Grouped GridView.