This is a migrated thread and some comments may be shown as answers.

Changing values in Model does not trigger Agregate Function

3 Answers 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 25 Oct 2011, 09:26 PM
I display a short list of data in WPF grid in MVVP environment.

I can edit some values in the grid itself and the SUM Agregate function is triggered and the Grid displays the new Total.

But if data is changed in the Model itself, the values are displayed in the grid rows but the SUM is not triggered !

In MVVP the Model is NOT aware of View controls and should not call a refresh method on the grid...

How can this be done ?

Thanks,

Michel

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Oct 2011, 06:49 AM
Hello Michel,

 Recalculation of aggregation will happen only after CollectionChanged not on PropertyChanged. If the grid recalculates all aggregates on every property change you will get huge performance problems. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Wouter
Top achievements
Rank 1
answered on 04 Apr 2014, 01:49 PM
I tried to solve this by reimplementing ObservableCollection like this:

    public class MyObservableCollection<T> : ObservableCollection<T>
    {
        public MyObservableCollection()
        {
        }

        public MyObservableCollection(IEnumerable<T> e)
            : base(e)
        {
        }

        public override event NotifyCollectionChangedEventHandler CollectionChanged;

        public void RaiseCollectionChanged()
        {
            var handle = this.CollectionChanged;
            if (handle != null)
            {
                handle(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
        }
    }

The problem is that after the item of a grouping that is selected for an aggregate method is removed the grouping disappears together with all the groupings below it.

How would you suggest making a conditional aggregation depending on checkboxes (for instance) in the GridView?
0
Dimitrina
Telerik team
answered on 07 Apr 2014, 11:28 AM
Hi,

Would you please test with GroupRenderMode="Flat"?
As to your second question: "How would you suggest making a conditional aggregation depending on checkboxes (for instance) in the GridView?". Would you please elaborate more detailed information on the exact requirement you have?

Regards,
Didie
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Michel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Wouter
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or