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
604
Catching MouseUp on cell
posted

Hello,

The requirement is to enter the edit mode of the cell on MouseUp.

What I did is:

 <igDP:XamDataGrid.FieldSettings>

 

 

 

<igDP:FieldSettings CellClickAction="SelectCell"/>

 

 

</igDP:XamDataGrid.FieldSettings>

 

 And then I register on XamDataGrid's PreviewMouseUp event and trying to figure out what cell was under the mouse when the MouseUp occured:

 void xamDataGridPreviewMouseUp(object sender, MouseButtonEventArgs e)

{

 DependencyObject source = e.OriginalSource as DependencyObject;

 i

f (source == null) return;

 

CellValuePresenter cvp = Infragistics.Windows.Utilities.GetAncestorFromType(source,

 

typeof(CellValuePresenter), true) as CellValuePresenter;

 

if (cvp == null) return;

 

 

 

 

cvp.StartEditMode();

 

 

 e.Handled = true;

 }

The problem is that cvp is always null.

Is there some other way to figure out what Cell was under the mouse on MouseUp?

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    This should be running correctly if you do not set the CellClickAction to Select Cell. If the CellClickAction is select cell, the OriginalSource will be the XamDataGrid and not the underlying editor in the cell. This is why calling the GetAncestorFromType always returns a null CellValuePresenter.

    What you can do is start the edit mode and then select the cell if you need to.

Children