I have a numeric field that contains a number of minutes. In the XamGrid, I want to display it as: x Days y Hours Z Minutes.
It is easy enough to add a property/field to the entity that converts it to the desired format, but then the sorting of the column will not work as intended.
I figure there are two options: find a way to use a custom format for the displaying of the field, or have the column set to the formatted field and have it sort on the original field.
As far as I can tell, it is not possible to set a column's sort to another field (not yet, anyway - there was some talk on it perhaps being added). There is the option to add the FieldSortDescription, but that seems to apply to the whole grid, and not a specific column - or did I get that wrong?
Is there a way to have the display formatting done in code? It would be extremely handy to be able to specify a method (that takes the field value as a parameter and returns the formatted result) as the format property. What is the best way to achieve this?
Hi,
The TextColumn has a FormatString property which you can use to change the formatting of the data in the cells.
Alternatively, you can use TemplateColumn and define the visualisation of your data using custom ItemTemplate.
Thanks Nikolay,
The FormatString won't help me here, but the TemplateColumn looks like just the thing!
I started Silverlight development for the first time last week, and last used Infragistics (for ASP.NET and WinForms) 2 years ago. I am thus unfamiliar with a lot, so I really appreciate the assistance as it helps me to shortcut the learning curve.