Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
How to get targeted Cell on drag/drop
posted

Hello,

I need to know above wich cell of a xamdatagrid is the mouse cursor when drop event occurs.

Using e.GetPosition(myDatagrid), I get the position of the cursor. I tried to deduce the targeted column by comparing sum of  fields width againts cursorpos.X but it doesn't work when the width is '*'.

For other purposes, cellclickaction="SelectRecord" so that i can't use this feature to find the cell

 

Parents
No Data
Reply
  • 12875
    Verified Answer
    posted

    Hi,

     

    This code should allow you to get the cell the mouse is over during the drop event.

     

    DependencyObject source = e.OriginalSource as DependencyObject;

    if (source == null) return;

     

    CellValuePresenter cvp =

                    Infragistics.Windows.Utilities.GetAncestorFromType(source, typeof(CellValuePresenter), true) as CellValuePresenter;

     

    if (cvp == null) return;

     

    MessageBox.Show(cvp.Value.ToString());

     

     

     

Children