Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataGrid with totals
Message
From
05/03/2013 10:21:14
 
 
To
05/03/2013 09:13:21
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01567310
Message ID:
01567440
Views:
13
>>>>>>>Hi,
>>>>>>>
>>>>>>>in XAML is there a way to add a row of totals to the bottom of a datagrid?
>>>>>>>
>>>>>>>For example I want something like this:
>>>>>>>
>>>>>>>
Invoice #   Invoice Amount
>>>>>>>1234        100.00
>>>>>>>1235        150.00
>>>>>>>2           250.00
>>>>>>>
>>>>>>>where 2 is the count of invoices and 250.00 is the total of the Invoice Amount column.
>>>>>>Is it feasible to add a total row to the data table?
>>>>>
>>>>>The problem I see with that is how to handle the sorting when a user re-orders the grid by clicking on the header.
>>>>
>>>>Hmm. Resizing and re-ordering of columns would work automatically. The difficulties would be in making sure the 'total's row was always the last regardless of sort order, not persisting it to the DB etc....
>>>
>>>Yes, Viv
>>>It's a kludge, but I've done it (blush)
>>>I'm not familiar with the DataGrid, but the DataGridView has a property that prevents the user from change the sequence of the grid
>>>Persisting to the DB should not be an issue if the datatable has been created only for display in the grid.
>>
>>But Frank needs to add/edit rows in the DataGrid and sort on columns. It's probably still possible but it would probably mean removing and re-adding the 'footer' row when the sort order changed. Might be OK when adding/deleting rows tho.....
>
>Just to clarify, the grid is a readonly display of data. However the data in the grid needs to get updated when changes to the underlying data is made. The form is a two tab form, one showing a list of selected data and the other tab allowing you to edit a row from the grid on the first tab. You can also add and delete rows.

Then I guess it depends how the DataGrid itself is updated on changes. If it is completely repopulated then adding the 'footer' row should be more doable....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform