Hello,
in a XamGrid with hierarchical data, we need to set whole rows or single cells as dragsources, depending on the cell's column (i.e the first cell with description should trigger row dragging, all other cells [carrying the values] should trigger single cell dragging.I've used CellControlAttached for setting up the dragsources, but CellControlAttached is not being called for all cells. It is called for all description cells, but only for the data cells of some rows. The rows where it is called appear to be the first row(s) of each child row collection, but from the 2. or 3. row on (varying) it is not being called for the data cells anymore. Any ideas why this would be? Is there any other way to create the drag sources for every cell in the grid?
Regards
Lars
Hello Lars,
I have managed to achieve the described behavior with the following code:
private void xamGrid_CellControlAttached(object sender, CellControlAttachedEventArgs e)
{
var cell = e.Cell;
DragSource dragSource = new DragSource()
IsDraggable = true,
};
if (cell.Column.Key == "FirstColumn")
cell.Row.Control.SetValue(DragDropManager.DragSourceProperty, dragSource);
}
else
cell.Control.SetValue(DragDropManager.DragSourceProperty, dragSource);
If you need more help, do not hesitate to ask!
Thanks,
Stefana
Hello Stefana,
thank you for you're answer. But I think there is some misunderstanding. xamGrid_CellControlAttached is not fired for every cell in the grid. It is only fired for some cells. How can I set the remaning cells as dragsources if the xamGrid_CellControlAttached event is not fired for these cells?