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
475
Excel like behaviour required for selecting and editing cells
posted

Hi,

I would like to implement similar behaviour to Excel in the XamDataGrid in that if you click on a cell it immediately enters edit mode.  Whereas if you hold the mouse down over a cell and drag you do a multiple select of all the cells you drag over. 

I get the first behaviour with..
<igDP:FieldSettings CellClickAction="EnterEditModeIfAllowed" />

and the second behavior with...
<igDP:FieldSettings CellClickAction="SelectCell" />

In addition I have the following settings..
<igDP:FieldLayoutSettings SelectionTypeCell="Extended" SelectionTypeRecord="Extended" SelectionTypeField="Extended" />

How can I get both of these behaviours working on the grid.  I don't see why this should be impossible as a click on a cell is surely different than a cell selection drag ?

Parents
No Data
Reply
  • 28407
    posted

    HI,

     You could force the cell into edit mode by using a DataPresenterCommand.

     Wire up the PreviewMouseLeftButtonDown event.

     Here is the code snippet:

     void xamgrid1_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
               // throw new NotImplementedException();
                DependencyObject soruce = e.OriginalSource as DependencyObject;
                if (soruce == null) return;
                CellValuePresenter cvp = Infragistics.Windows.Utilities.GetAncestorFromType(soruce, typeof(CellValuePresenter), true) as CellValuePresenter;
                if (cvp == null)
                    return;
                cvp.IsActive = true;
                xamgrid1.ExecuteCommand(DataPresenterCommands.StartEditMode);
            }

     Sincerely,
     Matt
     Developer Support Engineer

Children