This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, Is there anyway to set the last row of each column to a specific colour, both text and background, like the column footer? I am not using the footer as it cannot average time in the format I need it. Thanks. |
|
|
Hello, To set the background of an entire row, or a single cell, you can use the DataGrid.SetRowBackground and DataGrid.SetCellBackground methods respectively. The object you pass as a row is the raw data object from your items source that gets displayed as the last row. For cells, you need to pass a DataGridCell object which you could get via one of the GetCell methods on the DataGrid. All this is not very MVVM friendly though. Another solution may be to use the footer, and provide your own custom aggregate implementation for averaging DateTimes, and provide a template to display the result. For example, below is a possible implementation for an average date time aggregate. This extends AggregateBase to do most of the work for you. You get an enumeration of all the values in your items source. Then you can use the GetValue method on each item to extract the value based on the binding of the current column that is being evaluated. Check that the value is a DateTime, and then use whatever date time averaging calculation you need.
Then set this aggregate as the column footer aggregate, and provide a template to display the result in whatever time format you need:
Hope that helps! please let me know if you have any questions about this. -Jason Fauchelle |
|
|
Thanks a million Jason. It was the override of CalculateCore that I needed. |
|