Skip to main content

Microsoft Silverlight

Answered Question How can I start edit DataGrid cell pressing another keys than 'F2' and copy pressed char to textbox in editing template ?RSS Feed

(0)

Martin Kruszynski
Martin K...

Member

Member

15 points

27 Posts

How can I start edit DataGrid cell pressing another keys than 'F2' and copy pressed char to textbox in editing template ?

I would like implement start editing cell in DataGridTemplateColumn with pressing 'text characters' (like http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic5060.aspx) - like MS Excel.

DataGrid processes internal F2 keydown event and other specials like KeyDown, KeyUp etc.

I use event handlers:  void dataGrid_KeyDown(object sender, KeyEventArgs e){

if (!editing) {

if (IsTextKey(e.Key)) // for example A,B,C,D,... 1,2,3....

{

    dataGrid.BeginEdit(); }

}

void dataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e) {

KeyEventArgs args = e.EditingEventArgs as KeyEventArgs;

 

KeyEventArgs is not null when I press F2, but is null when I press 'A', 'B', 'C' etc...

How can I catch which key causes start edition cell and copy letter/digit to Text of Textbox (in DataGrid Cell editing template) ?

Martin Kruszynski
Martin K...

Member

Member

15 points

27 Posts

Answered Question

Re: How can I start edit DataGrid cell pressing another keys than 'F2' and copy pressed char to textbox in editing template ?

I know this:

I must use

dataGrid.BeginEdit(e);

instead of  dataGrid.BeginEdit(e);

 

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities