views:

49

answers:

2

I have a WPF DataGrid and i want to show a completion list below the cell currently being edited. I cannot seem to find a way to get the uncommitted value. I tryed catching all key down events but cannot find where the value is stored until it is committed.

A: 

Use the PreviewKeyDown event to get the actual value of the key that was pressed. You can then extract the DataRowView and the CurrentCell.Column.DisplayIndex from the sending object, that will give you the current cell contents without the new key that was pressed.

Mark Hall
+3  A: 

How about using the AutoCompleteBox from the WPF Toolkit in a DataGridTemplateColumn? (Sounds like it addresses your problem).

Goblin
+1, using existing tools is always better than reinventing the wheel (and the whole point of WPF is to use bindings and templates)
Alex Paven
+1 AutoCompleteBox is handy!
Avatar