Question

Does anyone how I can add a fixed last row / footer row to the WPF Toolkit DataGrid? I'd like to display a "summary" at the bottom of all Column Values.

Thank you.

Cheers

Was it helpful?

Solution 2

It's probably not the best way, but this is how I solved it:

   public class MyCollectionViewModel : ObservableCollection<SomeObject>
    {
        private readonly SomeObject _totalRow;

        public MyCollectionViewModel ()
        {
            _totalRow = new SomeObject() { IsTotalRow = true; };
            base.Add(_totalRow );
        }

        public new void Add(SomeObject item)
        {
            int i = base.Count -1;
            base.InsertItem(i, item);
        }
    }

Hope this might help anyone.

Cheers

OTHER TIPS

Another possibility would be to have a second DataGrid below your first grid, a summary DataGrid if you will.

You could perform data bindings to set the column sizings (if they are dynamic) and it would align nicely if placed in a grid layout in XAML.

Hope this gives you some ideas.

I can propose another solution. It is base on custom collection and comparer. You can adopt to your need as you want.

Here is described: http://pro.ingens.ru/2012/07/cwpf-datagrid-footer-row.html

In this solution footer rows won't be affected by the sorting and can be styled as you need. Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top