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
488
Edit mode
posted

Is there a way to disable a particular column so it can't be edited. Also, how do I prevent a cell entering edit mode when a cell is selected with the mouse but still allow it to enter edit mode when F2 is pressed.

  • 69686
    Suggested Answer
    posted

    Hello,

    You can use the EditModeStarting event and cancel it if the F2 key is not pressed, like so:

     void xamDataGrid1_EditModeStarting(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartingEventArgs e)

            {

                if (!Keyboard.IsKeyDown(Key.F2))

                    e.Cancel = true;

            }

    As you need this for a specific field, you can check the e.Cell.Field property as well.