Hi there
I have UltraWinGrid with a bound column of type decimal.
We wish to treat the column as an integer with no spin.
If I set the format of the column to be say "###,###,##0" the format is OK
but if I set the InputMask of the column to say "nnn,nnn,nnn" it by default seems to apply the spin functionality to the columns cells and if I apply the format only with no mask then the first cell I click in displays the value to 4 decimal places.
If instead of using the format and inputmask I use the ColumnStyle = Integer then the column becomes non-editable!
My question is what is the appropriate technique for having both the display and edit mask of a decimal to be that of an Integer.
Thanks in advance
geoffhop
Hi Geoff,
Try something like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridColumn decimalColumn = band.Columns["decimal 1"]; decimalColumn.Header.VisiblePosition = 1; decimalColumn.Format = "###,###,##0"; decimalColumn.MaskInput = "nnn,nnn,nnn"; EditorWithMask editorWithMask = decimalColumn.Editor as EditorWithMask; editorWithMask.SpinButtonDisplayStyle = SpinButtonDisplayStyle.None; }
Note that the grid re-uses the editors that it creates. So in this case, the EditorWithMask I am getting here will apply to ALL columns in the grid that are using masks. If that's not what you want, you will need to create a new editor, set it's SpinButtonDisplayStyle, and assign it to the column, instead of getting the one that is already there.
Great thanks for that.
A further question I have is that by setting the MaskInput on the column seems to cause the editor to increment/decrement the cells value when the up/down arrow keys are used.
It would like to remove this behaviour and just have the up/down arrow keys move up/down the rows.
Do I need to remove the KeyActionMappings on the EditorWithMask or can this be set via some other property?
What is the appropriate technique to achieve this?
Thanks again