Ticket Q536992
Visible to All Users

Chart bound to ObservableCollection does not update when collection members are updated

created 11 years ago

Hi,

I have a DXGrid and DXChart in different DockPanels in a DockLayoutManager. I am using MVVM and the Grid and chart are bound to the same Observable Collection in my view model.

When I initialize and load items into the ObservableCollection the grid and chart both update accordingly and display the data.

When I edit data in the grid, however, the chart is not updated. The Grid binding is set to TwoWay and data is definately changing becuase I am able to save changes to my back end database.

If I call
chart.UpdateData();

then the data in the Chart is refreshed and shows correctly, but it appears the binding is not working as expected. Its like the chart binding is always stuck in OneTime mode.

Based on this answer this appears by design ?
http://www.devexpress.com/Support/Center/Question/Details/Q289189

Has any option been added to allow this to be user configurable ? I appreciate its resource intensive - but I don't have many data points so the performance penalty in my case would be acceptable.

Thanks
Chris

Answers approved by DevExpress Support

created 11 years ago (modified 5 years ago)

[UPDATE] Starting with v18.1, INotifyPropertyChanged notifications are automatically processed for ObservableCollection<T> and BindingList<T> collections. Attached is a sample project that illustrates this approach.

[Original answer below]
Hi Chris,
That's correct, the issue is related to the fact that a collection does not send a notification that one of its items has been changed. To resolve this issue, create a FreezableCollection<YourDataPoint> class descendant and implement the INotifyCollectionChanged interface in it. You will find helpful information and a sample project in the Q382044ChartControl and DependencyProperty Binding report.

    Show previous comments (3)
    DevExpress Support Team 6 years ago

      Starting with v18.1, INotifyPropertyChanged notifications are automatically processed for ObservableCollection<T> and BindingList<T> collections. I have updated my original reply accordingly.

      CS CS
      Chris Schiefer 6 years ago

        What about collections other than those that implement INotifyCollectionChanged?

        DevExpress Support Team 6 years ago

          Hi Chris,

          As stated in the Solution section of this ticket, ChartControl now handles INotifyPropertyChanged notifications for BindingList<T> collections. If you need further assistance, feel free to ask.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.