W
WildGooose
Thanks Dmitrity Lapshin
First, I tried implementing by overriding IsInputKey. But,
finally realized that it works on a plain TextBox and not
within a TextBox with a DataGrid.
Dmitrity, the approach you susggested works.
I have 2 more questions though.
The ProcessKeyPreview event is fired each time I press
enter key on any columns in the Datagrid.
Is it possible to trigger the event only on a specific
column of the datagrid.
I implemented ProcessKeyPreview, and it seems to be
capturing only 'Enter' key.
Tab, and directional keys are not being captured. I have
also
implemented KeyPress and KeyDown methods to capture text
being edited. Implementing ProcessDialogKey does not seem
to make any difference other than being called before
invoking KeyPress and KeyDown methods.
Any suggestions on how to capture Tabs, and up, down, left
and right arrows.
Thanks for your suggestions.
First, I tried implementing by overriding IsInputKey. But,
finally realized that it works on a plain TextBox and not
within a TextBox with a DataGrid.
Dmitrity, the approach you susggested works.
I have 2 more questions though.
The ProcessKeyPreview event is fired each time I press
enter key on any columns in the Datagrid.
Is it possible to trigger the event only on a specific
column of the datagrid.
I implemented ProcessKeyPreview, and it seems to be
capturing only 'Enter' key.
Tab, and directional keys are not being captured. I have
also
implemented KeyPress and KeyDown methods to capture text
being edited. Implementing ProcessDialogKey does not seem
to make any difference other than being called before
invoking KeyPress and KeyDown methods.
Any suggestions on how to capture Tabs, and up, down, left
and right arrows.
Thanks for your suggestions.
-----Original Message-----
Hi,
You will need to override the following methods in the DataGrid itself to
tap into keyboard navigation:
ProcessDialogKey - this method will be called when no cell is being edited
ProcessKeyPreview - this method will be called whe a cell IS being edited to
separate control keys strokes as Tab or Arrows from regular alpha-numeric
keystrokes that should be treated as user input.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
Wild Goose said:Hi all, Need some help here.
I have created my own DataGridTextBoxColumn and
DataGridTableStyle and have bound this to the DataGrid.
I am trying to capture the text changed event on a
DataGridTextBoxColumn. I need an event to be triggered
when the user either edit's text in the textbox, or tabs
on textbox, hits enter key, or presses up/down/right/left
keys.
I tried capturing the LostFocus & Leave events on the
DataGridTextBoxColumn. These events fires only if the
users hits tab on the column. It does not fire on hitting
enter key.
The TextChanged event fires for each character typed,
which probably I think I should be using to check for
integrity of data, but then how do I tell once the user
has finished typing.
Can anyone help me in this context.
Let me know if you still need more explanation.
Thanks