I want to be able to apply custom formatting for some of the columns in the UltraGrid.
I want some of my double columns to be formatted in a specific way:
I also want this values to be editable and displayed in the same format while editing.
There is a way to achieve this for the standard Microsoft data grid by overriding the following methods of the DataGridTextBoxColumn:
Thanks for your replies Mike!
It seems to me (I haven't tried yet) that this will only work when user is editing the value.
CellUIElement, for example, doesn't have any properties which would allow you to assign a DataFilter.
Am I right?
The methods you refer to here in the DataGridViewColumn seem like that are similar to the DataFilter. The DataFilter allows you to intercept and modify the value as it moved from the editor to the display and vice versa.
I believe there are 2 ways to approach this.
1. in the InitializeRowLayout event of the grid set the cell editor to an UltraNumericEditor or UltraMaskedEditor. Then set the Format property of that editor control based on the cells value. You will also want to set the InputMask property to control how the data data looks during edit mode.
2. use a DataFilter. A data filter basically allows you to control the format of data when displaying to or extracting it from the grid. There are several examples of implementing data filters in the help files. There are 4 conversion directions that you can intercept in the data filter to control how the data is diplayed or extracted. OwnerToEditor, EditorToOwner, DisplayToEditor and EditorToDisplay. If you choose to go this route I recommend looking at some of the examples that they provide.