This is a migrated thread and some comments may be shown as answers.

Disable Modifier Keys as EditTrigger

2 Answers 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 05 Dec 2012, 12:07 AM
I have a grid with the setting EditTriggers="TextInput,CellClick".  Text input seems to be triggered  by text with modifier keys, e.g. Ctrl-T, Alt-T.  I want to disable this behavior so that only text without a modifier puts the cell into edit mode.

I've tried using a custom keyboard command provider, but it appears that the default ProvideCommandsForKey() doesn't return commands for text input, and that there must be some other mechanism that triggers the edit mode.

How can I prevent text input with modifier keys from triggering edit mode.

Thanks,
-Jeff


2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 05 Dec 2012, 07:55 AM
Hi Jeff,

You can try handling BeginningEdit event of the grid and cancel it in case Ctrl key is pressed.
For example:

private void clubsGrid_BeginningEdit(object sender, GridViewBeginningEditRoutedEventArgs e)
        {
            if (KeyboardModifiers.IsControlDown)
            {
                e.Cancel = true;
            }
        }
 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jeff
Top achievements
Rank 1
answered on 05 Dec 2012, 03:16 PM
Perfect.  Thanks Maya.
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or