I having a hard time getting the grid to refresh after a drag and drop on a row. I have a "displayOrder" column where on drop, it renumbers the column and save to the db. That works fine. The grid is bound to an observable collection so it should reflect immediately. Here's some code:
{
item.DisplayOrder = newIdx++;
}
private
void RowReorder_AfterDrop()
{
short
newIdx = 1;
foreach (var item in oSupplyRules)
{
item.DisplayOrder = newIdx++;
}
}
private void RowReorderBehavior_DragEnded(object sender, DragEndedEventArgs e)
{
MessageBox.Show(string.Format("Drop complete! Index: {0}"
, e.DestinationIndex));
var items = ((IList)e.SourceGrid.ItemsSource);
using
(e.SourceGrid.Items.DeferRefresh())
{
foreach (var item in e.DraggedItems)
{
items.Remove(item);
}
foreach (var item in e.DraggedItems)
{
if
(e.DestinationIndex < items.Count)
{
items.Insert(e.DestinationIndex, item);
}
else
{
items.Add(item);
}
}
RowReorder_AfterDrop();
}
DM.Context.SubmitChanges(); e.SourceGrid.Rebind();}
Any help would be GREATLY appreciated!