Welcome to the Xceed Community | Help
Community Search  
More Search Options

Groupings not updating when property changes

Sort Posts: Previous Next
  •  08-22-2011, 1:36 AM Post no. 30893

    Groupings not updating when property changes

    Hi,

    I am having a similar issue to the following post http://xceed.com/CS/forums/post/16226.aspx

    My Datagrid is bound to an ObservableCollection, if I apply a grouping to a column, when the grouped property changes on the items in the grid, the value in the cell are updates as expected (due to the property changed notification), however the grouping isn't reevaluated, and as such the groups become outdated.

    The previous post mentions another KB article, however that link appears dead.

    Any help would be appreciated

     

    Regards,

    Liam

    Filed under: ,
  •  08-22-2011, 2:46 PM Post no. 30898 in reply to 30893

    Re: Groupings not updating when property changes

    Hi Liam, 

    This behavior is expected, an observable collection only notifies when a new item is added or removed, and even when implementing INotifyPropertyChanged, our datagrid recalculates its grouping whenever a items are added/removed. 

    There are many possible workarounds that you might want to implement, one of them is for example to let the underlying business object class to have a reference to its parent list, and whenever an item property changes within the object, it would do a reset on the parent list at the index of the changing item. 

     Something like this:

    MyBusinessObject

    {

    ObservableCollection<MyBusinessObject> parentListReference; 

     public string myProperty

            {

                get { return _prop; }

                set

                {

                    if (_prop!= value)

                    {

                        _prop = value;

                        OnPropertyChanged("myProperty");

                        parentListReference.RemoveAt( parent.Items.IndexOf( this ) );

                        parentListReference.Add( this );

                        }

                    }

                }

            } 

     If you need more help your specific case, we would need a sample project that demonstrates your problem so that we investigate this in more detail.

    You can send it to support@xceed.com, please include a reference to this forum post in your email.  


    Best Regards,

    Michel Dahdah
    Technical Support
    Xceed Software inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.