Hello,
dnd between two gridviews is not working since the upgrade from 2016.3.914.45 to 2016.3.1024.45.
In the OnDragInitialize methode I'm assigning a DnD object to eventargs.Data which is not recognized by the drop table "eventargs.Data.GetDataPresent()".
It worked perfectly in the previous version but caused yesterday a lot of trouble after upgrading an application to the latest version :(
private void OnDragInitialize(object sender, Telerik.Windows.DragDrop.DragInitializeEventArgs ea) {
string displayText = "";
var selectedRows = ((RadGridView)sender).SelectedItems;
if (selectedRows.Count == 0) {
return;
}
var list = new List<PsCore.DataObjects.DragAndDrop.BusinessPartnerEntityDndDO>();
foreach (PsCore.Interfaces.IDndDataObject row in selectedRows) {
list.Add(new PsCore.DataObjects.DragAndDrop.BusinessPartnerEntityDndDO(row.PrimaryID, row.DisplayText));
displayText = row.DisplayText;
}
ea.Data = new PsCore.DataObjects.DragAndDrop.DndContainerDO<PsCore.DataObjects.DragAndDrop.BusinessPartnerEntityDndDO>(list, displayText);
ea.DragVisual = new ContentControl { ContentTemplate = LayoutRoot.Resources["DraggedItemTemplate"] as DataTemplate, Content = ea.Data };
this.dragVisualTemp = ea.DragVisual;
ea.DragVisualOffset = new Point(ea.RelativeStartPoint.X, ea.RelativeStartPoint.Y - 20);
ea.AllowedEffects = DragDropEffects.All;
ea.Handled = true;
}
private bool IsDndObjectAllowed(DragEventArgs ea) {
Type dndContainerType = typeof(DndContainerDO<BusinessPartnerEntityDndDO>);
if (!ea.Data.GetDataPresent(dndContainerType)) {
Console.WriteLine("DND object NOT recognized");
return false;
}
var draggedData = (ea.Data as DataObject).GetData(dndContainerType) as DndContainerDO<BusinessPartnerEntityDndDO>;
if ((draggedData != null) && (draggedData.Items.GetType() == typeof(List<BusinessPartnerEntityDndDO>))) {
return true;
}
return false;
}
Best Regards,
Raul