I've ready through the migration guide, overview, and DragDropPayloadManager guides, but there is still not enough information to migrate my existing code.Even the migration guide isn't sure which event maps to which event (see attached photo).
Can someone familiar with making the migration help me port over this code since basically everything has changed?
public void OnDragInfo(object sender, DragDropEventArgs e)
{
if (e.Options.Status == DragStatus.DropImpossible && DragCue != null)
{
DragCue.Background = DropImpossibleBackground;
DropIndicator.Opacity = 0;
}
else if (DragCue != null)
{
DragCue.Background = DropPossibleBackground;
DropIndicator.HorizontalOffset = e.Options.CurrentDragPoint.X - e.Options.RelativeDragPoint.X;
DropIndicator.VerticalOffset = e.Options.CurrentDragPoint.Y - e.Options.RelativeDragPoint.Y + DropIndicator.Height;
Debug.WriteLine(e.Options.CurrentDragPoint);
DropIndicator.Opacity = 100;
}
}
public void OnDragQuery(object sender, DragDropQueryEventArgs e)
{
GridViewRow row = sender as GridViewRow;
e.QueryResult = RadDragAndDropManager.GetAllowDrag(row) &&
(e.Options.Destination == null || e.Options.Destination is GridViewRow);
if ((e.QueryResult ?? false) && e.Options.Status == DragStatus.DragQuery)
{
e.Options.Payload = row?.DataContext;
}
}
public void OnDropInfo(object sender, DragDropEventArgs e)
{
object item = e.Options.Payload;
GridViewRow source = e.Options.Source as GridViewRow;
GridViewRow destination = e.Options.Destination as GridViewRow;
if (source != null && destination != null && AssociatedObject.Items.Contains(item) && e.Options.Status == DragStatus.DragComplete)
{
int index = AssociatedObject.ItemContainerGenerator.IndexFromContainer(destination);
((IList) AssociatedObject.ItemsSource).Remove(item);
((IList) AssociatedObject.ItemsSource).Insert(index, item);
if (!ItemsSourceSupportNotifications)
{
AssociatedObject.Rebind();
}
DropIndicator.IsOpen = false;
}
if (e.Options.Status == DragStatus.DragCancel)
{
DropIndicator.IsOpen = false;
}
}
public void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
GridViewRow targetRow = e.Options.Destination as GridViewRow;
if (targetRow != null)
{
e.QueryResult = targetRow.GridViewDataControl == AssociatedObject;
}
else
{
e.QueryResult = false;
}
}
Can someone familiar with making the migration help me port over this code since basically everything has changed?
public void OnDragInfo(object sender, DragDropEventArgs e)
{
if (e.Options.Status == DragStatus.DropImpossible && DragCue != null)
{
DragCue.Background = DropImpossibleBackground;
DropIndicator.Opacity = 0;
}
else if (DragCue != null)
{
DragCue.Background = DropPossibleBackground;
DropIndicator.HorizontalOffset = e.Options.CurrentDragPoint.X - e.Options.RelativeDragPoint.X;
DropIndicator.VerticalOffset = e.Options.CurrentDragPoint.Y - e.Options.RelativeDragPoint.Y + DropIndicator.Height;
Debug.WriteLine(e.Options.CurrentDragPoint);
DropIndicator.Opacity = 100;
}
}
public void OnDragQuery(object sender, DragDropQueryEventArgs e)
{
GridViewRow row = sender as GridViewRow;
e.QueryResult = RadDragAndDropManager.GetAllowDrag(row) &&
(e.Options.Destination == null || e.Options.Destination is GridViewRow);
if ((e.QueryResult ?? false) && e.Options.Status == DragStatus.DragQuery)
{
e.Options.Payload = row?.DataContext;
}
}
public void OnDropInfo(object sender, DragDropEventArgs e)
{
object item = e.Options.Payload;
GridViewRow source = e.Options.Source as GridViewRow;
GridViewRow destination = e.Options.Destination as GridViewRow;
if (source != null && destination != null && AssociatedObject.Items.Contains(item) && e.Options.Status == DragStatus.DragComplete)
{
int index = AssociatedObject.ItemContainerGenerator.IndexFromContainer(destination);
((IList) AssociatedObject.ItemsSource).Remove(item);
((IList) AssociatedObject.ItemsSource).Insert(index, item);
if (!ItemsSourceSupportNotifications)
{
AssociatedObject.Rebind();
}
DropIndicator.IsOpen = false;
}
if (e.Options.Status == DragStatus.DragCancel)
{
DropIndicator.IsOpen = false;
}
}
public void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
GridViewRow targetRow = e.Options.Destination as GridViewRow;
if (targetRow != null)
{
e.QueryResult = targetRow.GridViewDataControl == AssociatedObject;
}
else
{
e.QueryResult = false;
}
}