I am trying to implement reordering rows in a Silverlight DataGrid. For this I am extending the default DataGridDragDropTarget
, and I need to override and implement the following method:
protected override DataGridRow ContainerFromIndex(DataGrid itemsControl, int index)
{
}
How can I get the DataGridRow from the DataGrid and the Index?
I haven't looked at the
DataGridDragDropTarget
yet, but couldn't you do just?
If that is not implemented for whatever reason, you can try this:
I don't know however how you want to implement the reordering of rows. Chances are you must keep track of your indexes by yourself and return one of your own stored index values in that method.
A slight improvement on Herzmeister's answer, see comments: