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
880
How to go into edit mode as you start entering a value?
posted

I have a grid with cells that can be selected or edited, so when you click on a cell it doesn't go into edit mode. I want to be able to type directly into the cell even though it isn't in edit mode.

The way I usually do this is to trap the key press, go in edit mode, set the editor text to the key that has just been pressed, and finally set the selection position to after the character that has just been entered. This method works fine for simple text editors where the data source is a string.

I'm trying to get it to work with a grid that is bound to business objects and uses a data filter to do the conversion. The problem is that when you set the ActiveCell Value programatically then it doesn't go through the filter so you get a type conversion error.

I could call the Convert method myself (checking that EditorResolved.DataFilter is present) but you have to pass in a EditorDataFilterConvertArgs object and there's no public constructor.

Any ideas on how to get the value to convert (another way of setting the value that does the conversion, maybe) or another way of achieving the same effect?

Thanks,

John.