DataGrids don't support ordering. They provide the functionality to store what the sort expression is however. With that you can tell your data provider (in your case, the collection) what the sort expression is. Usually this is used with a database. You will need to write sorting logic for your specific collection.
How are you trying to format the output? Can we see some code?