Hi I have a xamDataGrid which i got drag and drop enabled so the user can reorder the rows. But the problem is that if i resize the data grid so that horizontal or vertical scrollbar appears, and if i have a record row selected in the grid, when i drag the scroll bar the mouse move will also trigger the reordering.
How can i disable the drag and drop behavior if I just want to drag the scroll bar?
Or is there a way to determine that the mouse click is on the scroll bar? thanks.
i see the problem. I have to handle this event in the
PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
event handler, i am currently handing this in
PreviewMouseMove(object sender, MouseEventArgs e)
event handler. And apparently the e is different in the two event handlers.
I can now differentiate drag header now. but i am still having issue to resizing the columns. If i have an active record and trying to resize the columns, the drag and drop is again being invoked. I noticed that the resizing of the columns will not trigger the
event handler. What should I do to resolve this? thanks.
Update: i have opened a new thread on this issue. Thanks.
http://forums.infragistics.com/forums/p/39427/223810.aspx#223810
I used your code but drp will always return me null no matter if I dragged the header or the record itself. Any ideas?
You can try something like this:
DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(DataRecordPresenter), false) as DataRecordPresenter;
if(drp!=null && drp.Record.RecodType==....)
....
Thanks. but I looked into e.OriginalSource base and couldn't find a way to traverse the visual tree. There's no ancestor or things like that property available there. What did I miss?
You would have to check the type of the record on the mouse down event. You probably want to start dragging only on DataRecords. You can do that by traversing the visual tree, starting from the e.OriginalSource and look in the ancestor chain of elements.