I'm using the new DragDropManager and trying to stay as close to the standard Windows/WPF approach as much as possible. Most of the examples here use the RadDragAndDropManager, and I haven't been able to find examples using the new approach.
I have a form with 2 grids (i.e. RadGridView). There are 2 possible drag/drop scenarios:
Scenario 1. Drag a row from the left grid, and drop onto a row in the right grid, in order to create an association. In this scenario I need to determine how to Provide a visual indicator of the drop target row. This could be achieved by displaying the default mouse-hover highlight on a row, which seems to be turned off during drag/drop. Is there a way to selectively turn this on and off from within the DragEnter and DragLeave events?
Scenario 2. Use drag/drop to reorder rows within either grid. In this scenario I need to determine how to display a visual indicator of where the dragged row will be moved to, via an indicator line between the rows. I notice that the RadTreeListView contains a nice template for this. I can use the RadTreeListView instead of the RadGridView to take advantage of this. However this indicator seems to be always on or off based on the IsDragDropEnabled property. Can this template be toggled on/off from within DragEnter and DragLeave events? Also how can I determine if the drop point is before or after the target row.
You'll notice that the right grid handles both scenarios, depending on the drag source. Here is the DragOver handler which provides feedback on what effect (if any) the drop would have.
e.Effects = DragDropEffects.None;
GridViewRow row = FindVisualParent<GridViewRow>(e.OriginalSource as UIElement);
Attribute attribute = row == null ? null : row.Item as Attribute;
IDataObject dataObject = (IDataObject)e.Data;
if (dataObject.GetDataPresent(typeof(Field)))
{
if (attribute != null && attribute.Children.Count == 0)
{
e.Effects = DragDropEffects.Link;
}
}
else if (dataObject.GetDataPresent(typeof(Attribute)))
{
e.Effects = DragDropEffects.Move;
}
e.Handled = true;
Also I notice that unlike the RadDragAndDropManager, the new DragDropManager doesn't seem to support auto scrolling of a list. How would that be handled?
Thanks for your help.
I have a form with 2 grids (i.e. RadGridView). There are 2 possible drag/drop scenarios:
Scenario 1. Drag a row from the left grid, and drop onto a row in the right grid, in order to create an association. In this scenario I need to determine how to Provide a visual indicator of the drop target row. This could be achieved by displaying the default mouse-hover highlight on a row, which seems to be turned off during drag/drop. Is there a way to selectively turn this on and off from within the DragEnter and DragLeave events?
Scenario 2. Use drag/drop to reorder rows within either grid. In this scenario I need to determine how to display a visual indicator of where the dragged row will be moved to, via an indicator line between the rows. I notice that the RadTreeListView contains a nice template for this. I can use the RadTreeListView instead of the RadGridView to take advantage of this. However this indicator seems to be always on or off based on the IsDragDropEnabled property. Can this template be toggled on/off from within DragEnter and DragLeave events? Also how can I determine if the drop point is before or after the target row.
You'll notice that the right grid handles both scenarios, depending on the drag source. Here is the DragOver handler which provides feedback on what effect (if any) the drop would have.
private
static
void
OnRightGridDragOver(
object
sender, DragEventArgs e)
{
GridViewRow row = FindVisualParent<GridViewRow>(e.OriginalSource as UIElement);
Attribute attribute = row == null ? null : row.Item as Attribute;
IDataObject dataObject = (IDataObject)e.Data;
if (dataObject.GetDataPresent(typeof(Field)))
{
if (attribute != null && attribute.Children.Count == 0)
{
e.Effects = DragDropEffects.Link;
}
}
else if (dataObject.GetDataPresent(typeof(Attribute)))
{
e.Effects = DragDropEffects.Move;
}
e.Handled = true;
}
Also I notice that unlike the RadDragAndDropManager, the new DragDropManager doesn't seem to support auto scrolling of a list. How would that be handled?
Thanks for your help.