Group header aggregate summary

I am trying to implement the group header aggregate summary example from documentation of sfListView. What i want is to sum the value of a field that is also a field in the list datasource. For example MyValue. The problem i have is that if the field is changed in a row the group header value is not updated


listView.GroupHeaderTemplate = new DataTemplate(() =>
{
   var grid = new Grid();

   var label1 = new Label();
   label1.SetBinding(Label.TextProperty, new Binding("Key"));

   var label2 = new Label();
   Binding binding = new Binding("Items");
   binding.Converter = new Converter();
   label2.SetBinding(Label.TextProperty,binding);

   grid.Children.Add(label1);
   grid.Children.Add(label2, 1, 0);

   return grid;
 });

 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
           decimal result = 0;
            var items = value as IEnumerable;
            if (items != null)
            {
                result = items.ToList<MyObject>().Sum(item => item.MyValue);
} return result; }

2 Replies 1 reply marked as answer

LA Loukas Antoniou October 2, 2020 11:52 AM UTC

if i use the following line i have the desired update 

 listView.RefreshListViewItem(-1, -1, true); 

however the whole list gets updated with a blinking effect and quite a delay. I wa looking for a smoother solution 

thank you


LN Lakshmi Natarajan Syncfusion Team October 5, 2020 12:50 PM UTC

Hi Loukas, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “Group header aggregate summary” from our side. We would like to inform you that the GroupHeader could not get the notification when the group item data is changed, since, the GroupHeader has different BindingContext. So, it is recommended to refresh the ListView manually to reflect the changes in the UI. This is the expected behavior in SfListView.  
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 


Marked as answer
Loader.
Up arrow icon