I'm using embended masked edit in WinGrid.
What I dislike is numbers ++/-- functionality when using up/down arrow keys.
I've tried to disable this option as presented below, but this doesnt work to me.
Any idea what I'm doing wrong... ?
// Construct & setup editor UltraMaskedEdit mtEdit = new UltraMaskedEdit(); // Common settings mtEdit.Visible = false; mtEdit.InputMask = inputMask; mtEdit.Nullable = false; mtEdit.PromptChar = ' '; column.Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing; // Remove up/down arrow key action for (int i = mtEdit.KeyActionMappings.Count -1; i>=0; i--) { KeyActionMappingBase kam = mtEdit.KeyActionMappings[i]; MaskedEditAction action = (MaskedEditAction)kam.ActionCode; Console.WriteLine(action); switch (action) { case MaskedEditAction.DownKeyAction: case MaskedEditAction.UpKeyAction: mtEdit.KeyActionMappings.Remove(i); break; } } // Finally Marge with grid ultGrid.DisplayLayout.Bands[0].Columns[sourceColumn].EditorControl = mtEdit;
I tried this and it worked:
UltraGridColumn column = this.ultraGrid.DisplayLayout.Bands[0].Columns["whatever"];EditorWithMask editorWithMask = new EditorWithMask();column.Editor = editorWithMask;for ( int i = editorWithMask.KeyActionMappings.Count - 1; i >= 0; i-- ){ KeyActionMappingBase km = editorWithMask.KeyActionMappings[i]; if ( km.KeyCode == Keys.Up || km.KeyCode == Keys.Down ) editorWithMask.KeyActionMappings.Remove( km );}
Thanks for tip, but how can I setup input mask for this type of editor
(I couldn't find inputMask property for it)
I'm interested to allow entering only positive numbers here with 2 dec places
EDIT: OK I found I need use grid cell's inputMask propertry for that.
Thanks!
You can use the InputMask property on the column.
Or, if you need to use different masks, you can set the mask properties on the editor and UseEditorMaskSettings on the column to true.
Oh I dint know there is InputMask on column! ThanksThis resolves my issue with number formatting - so I'm happy to stick this approach.
But then I have same issue with up/down arrows incrementing numbers - can you please advice how to fix that in this scenario ?
To disable the arrows, I think you will need to use an editor. The point I was trying to make is that you can set the InputMask on the editor rather than the column, but you just have to set the UseEditorMaskSettings on the column. :)
I've used Editor property and remove this arrow action and finally works I'd like to see :)
Many thanks!