Hello
I have the following problem. I have a grid with a datasource behind it. I will take one column as an example. The column is of type Double. The data in the datasource are double values with several decimal points, for example 5.24586364348. We apply formatting on the grid for the column by using:
grid.DisplayLayout.Bands[bandNo].Columns["Price"].Format = DataFormatter.FOUR_DP;
where FOUR_DP is "f4" (the MicroSoft formatting strings).
What we want to be able to do is round up the number while applying the decimal point format. For example the value 5.24586364348 rounded up to 4 decimal points to be displayed as 5.2459 (rounding up to the fourth decimal point) rather than 5.2358 (simply only including up to four decimal points).
Is there a way that this can be done easily within the infragistics grid?
Many thanks
Kostas.
Format just calls ToString on the cell's Value and passes in the format you specify. I would think that f4 would do exactly what you are describing. But if not, I recommend that you check Microsoft's documentation on the ToString method for Double and see if there is a format that will do what you want.
If there is no such format, then you would have to handle this yourself. There are a number of ways you could do it. For example, you could hide the "real" cound column and add an unbound column to the grid to display the data. Or you could use a DrawFilter to draw the text of the cell yourself. Or a CreationFilter to alter the text displayed by the UIElement without changing the actual cell value.