Hello,
We implemented Drag and Drop with a XamDataGrid, and it is working well... as long you do not filter. If there is a filter active, it gets the wrong datarecordpresenter.
BR
Ralph
private void grid_ImportLabel_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("LabelAliasUIInfo")) { HitTestResult result = VisualTreeHelper.HitTest(this.grid_ImportLabel, e.GetPosition(this.grid_ImportLabel)); if (result.VisualHit != null) { DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(result.VisualHit, typeof(DataRecordPresenter), true) as DataRecordPresenter; if (drp != null) {
Hello Ralph,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Hi,
sorry the last time was a bit stressy. Here you have the requested sample project.
If you filter the sourcegrid (right) for "def" and drag the first(def1) entry into one of the entries of the left(target) grid it takes "abc1" instead of "def1". if you do not filter everything is ok.
same behaviour if you filter the target grid for "def" and drop something on def1 it gets added to abc1.
if you look into mainwindow.xaml.cs you can find the problem on line 105 and 141.
var drp = Utilities.GetAncestorFromType(result.VisualHit, typeof (DataRecordPresenter), true) as DataRecordPresenter;
is not taking the filter into account.
(please notify me on ralph.bariz@avl.com, I cannot see the mails the registered emailadress of AVL_List_GmbH receives)
kind regards
Ralph Bariz
I have been looking into your sample and I modified it, so now it works correctly. Basically I moved the logic for the Dragging in the XamDataGrid's PreviewMouseLeftButtonDown event and used the MouseButtonEventArgs' OriginalSource Property instead of using the mouse position.
thanks, the orinialsource is the solution.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.