Hi there,
I've several questions concerning individual formatting of data cells in a DataGrid. I've set the column to be of type string but want to override this type for some cells to be e.g. a DateTime or Decimal type. To a certain extent I succeeded doing that but I missing some parts to meet the requirements. Here are my questions one by one:
Thanks in advance, Wolfgang
Wolfgang Pöchgraber said:Formatting of a DateTime Cell. I've added one line to my code:ultraGrid.Rows[0].Cells[0].Style = ColumnStyle.DateThis shows a Date Picker for that cell which is perfect and also after a date is selected it is shown in the cell but the question is how can I change the format of that date since it seems that it is displayed in local date format but I want to show it differently?
I think you would have to use an editor. Instead of setting the Style of the column, place an UltraDateTimeEditor on the form and set the EditorControl property of the cell to this control. Then you can set up the mask settings on the UltraDateTimeEditor however you like. You will need to set UseEditorMaskSettings to true on the column to tell it to use the UltraDateTimeEditor mask settings, instead of the settings on the column.
Wolfgang Pöchgraber said:For displaying a currency value I want to display a character for seperating multiples of thousands. I'm using an UltraNumericEditor as the EditorControl for that cell where I set both the MaskInput and the FormatString and during typing (cell has focus) this shows perfectly what I want. As soon as the cell does not have the focus anymore it doesn't display the characters for seperating multiples of thousands. The decimals are presented correctly. I also tried UltraMaskedEdit instead of UltraNumericEditor and the result was the same.Here is the small code snippet:ultraGrid.Rows[1].Cells[0].CellDisplayStyle = CellDisplayStyle.FormattedText;var numericEditor = new UltraNumericEditor { NumericType = NumericType.Decimal, MaskInput = "n,nnn,nnn.nn", FormatString = "n,nnn,nnn.nn"};ultraGrid.Rows[1].Cells[0].EditorControl = numericEditor;I've also tried it without setting CellDisplayStyle but that didn't help either.
I think you may be able to get this work by setting the MaskDisplayMode on the Numeric editor. If that does not work, then the only thing you can do is use a DataFilter to format the text yourself.