Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
How to obtain Excel-like behaviour using XamDataGrid
posted

Hi,

I am trying to make a XamDataGrid act a little bit like Excel. In particular, the bit I'm having issues with is that when a field is selected and I start typing, I want the field to go into edit mode and overwrite the current value with whatever I've just typed (just like on a spreadsheet). So far I've managed to do this by using the GridPreviewKeyDown event:

if (IsPrintable(e.Key)) grid.ExecuteCommand(DataPresenterCommands.StartEditMode);

This seems to work fine when using default editors, but I'm having problem with cells using custom editors. The problem I'm having is that when I type on a selected cell using a custom editor, I cannot figure out how to make my text overwrite the cell's contents, just like the non-custom editors.

Does anyone know if there's a solution to this, or whether I'm doing somethign wrong/there is a better way of implementing this?

Many thanks