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

How to set multiple (custom) editTriggers for the DataGrid

6 Answers 271 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ujjwal Lahoti
Top achievements
Rank 1
Ujjwal Lahoti asked on 07 Apr 2010, 07:24 AM
Default setting for the EditTriggers in the DataGrid is "Mouse DoubleClick". However I want to be able to edit the cells if either of the following events happen:

1. Enter Key Press
2. Mouse DoubleClick
3. F2 Key Press

Can you tell me how to do this? I didn't find anything in the documentation regarding this.

6 Answers, 1 is accepted

Sort by
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 08 Apr 2010, 03:26 PM
Any answers/comments?
0
Stefan Dobrev
Telerik team
answered on 09 Apr 2010, 03:09 PM
Hello Ujjwal,

RadGridView will automatically start editing on F2 and double click. If you want start editing by pressing the "Enter" key you have to write your own IKeyboardCommandProvider and implement the logic there. You can derive from our DefaultKeyboardProvider and assign your implementation to the KeyboardCommandProvider property of RadGridView.

Regards,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 09 Apr 2010, 03:32 PM
Thanks for the reply. Can you provide some sample code to do this?

Also, can you clarify if you can define multiple "EditTriggers" for the DataGrid? For eg. if you set Edit trigger to single click: EditTriggers="CellClick", then only one mouse click would work, F2 will not work. I was wondering if I can define something like:

EditTriggers="CellClick|F2" (this syntax doesn't work), to allow editing by mouse click or by F2.
0
Vlad
Telerik team
answered on 09 Apr 2010, 03:38 PM
Hello,

You can use this syntax instead: ... EditTriggers="CellClick,F2"...

Greetings,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 09 Apr 2010, 04:24 PM
Thanks for the quick response. The syntax works fine.

Also can you provide some code to write my own IKeyboardCommandProvider (as described in the reply from , and how to register the new class so that it appears in the property view.
0
Nedyalko Nikolov
Telerik team
answered on 14 Apr 2010, 08:09 PM
Hi Ujjwal Lahoti,

I'm attaching an example how to use IKeyboardCommandProvider interface with RadGridView. As I understand example do exact what you want. Take a look at CustomCommandProvider class and its usage.

P.S. The example is a Silverlight application, but will work for WPF too.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Ujjwal Lahoti
Top achievements
Rank 1
Answers by
Ujjwal Lahoti
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Vlad
Telerik team
Nedyalko Nikolov
Telerik team
Share this question
or