Custom DataGrid Aggregate refresh issue

Posted by: abellisomi on 20 January 2020, 10:10 am EST

    • Post Options:
    • Link

    Posted 20 January 2020, 10:10 am EST

    I am trying to get a custom

    DataGridAggregate
    Implementation. I implemented a class such as:

    
        public class MyDataGridAggregate : DataGridAggregate
        {
            public override object Compute(DataGridRowCollection rows, DataGridColumn column, bool recursive)
            {
                var items= rows.As<DataGridRowCollection>().ToList().Select(x => x.DataItem).OfType<MyModel>().Select(pd => pd.InterestingField).Distinct().ToList();
                return string.Join(@",", items);
            }
        }
    
    

    This gets attached to a

    DataGridTextColumn
    this way:

    
    <c1:DataGridTextColumn Binding="{Binding SomeName}">
                                            <c1:DataGridAggregate.AggregateFunctions>
                                                <c1:DataGridAggregatesCollection>
                                                    <planDetail:MyDataGridAggregate ResultFormat="D = {0}"/>
                                                </c1:DataGridAggregatesCollection>
                                            </c1:DataGridAggregate.AggregateFunctions>
                                        </c1:DataGridTextColumn>
    
    

    The custom aggregator gets called correctly, however the group row value does not get refreshed when I update the underlying data of

    InterestingField
    . How can make sure this happens correctly?

    Thank you

  • Posted 20 January 2020, 11:45 pm EST

    Hello,

    Are you implementing INotifyPropertyChanged in your model? I don’t find anything else that could cause this issue for you. For your verification, I have prepared an application, kindly refer the same.

    Best wishes,

    Ruchir

    DataGridSamples.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels