We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to calculate a group summary based on a parent group

Thread ID:

Created:

Updated:

Platform:

Replies:

111005 Sep 3,2013 02:44 PM Sep 10,2013 05:44 AM WPF 1
loading
Tags: GridControl
Richard
Asked On September 3, 2013 02:44 PM

Hi,

How can I implement a custom group summary that performs a calculation based on the parent group? ISummaryAggregate's CalculateAggregateFunc() only provides the records in the current group, and there does not appear to be a way to access the parent group.

 

Thanks.

 

---

Richard


Gobinath A [Syncfusion]
Replied On September 10, 2013 05:44 AM

Hi Richard,

Thanks for your patience.

We can get the parent record in the following Highlighted code in the CalculateAggregateFunc() method and you have to calculate the child group record also in the below method.

Code snippet[C#]:


public Action<System.Collections.IEnumerable, string, System.ComponentModel.PropertyDescriptor> CalculateAggregateFunc()

{

  return (items, property, pd) =>

   {

     var enumerableItems = items as IEnumerable<Data>;

     if (pd.Name == "Price")

      {

       this.Price = enumerableItems.CountTo<Data>(q => q.ProductPrice);

      //We can get the child record in the below line of code

    //  this.ChildPrice = enumerableItems.CountToParent<Data>(q => q.Collection[i].ProductPrice);

      }

    };

}

For your reference we have attached simple sample and please find the sample under the following location.

Sample: NestedWithObserveCollection.zip

 

Please let us know if you have any queries.

Regards,

Gobinath A


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;