Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1015
Serialization of xamDataChart ViewModel Not Possible
posted

I am using the xamDataChart in an application where I serialize the viewmodel so I can persist the settings to the graph control. This is necessary because the series created are unknown at compile time and the data is unknown until runtime. I add series to the chart by binding to the graph SeriesCollection and adding series to this collection per user interaction.

All of my graph operation works fine, however since this SeriesCollection is read only, when I try to deserialize my viewmodel, I can't as I have no reference in my viewmodel to the graph control. Why is the graph SeriesCollection read only? This leads me to believe that this graph is not truly MVVM compliant...

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi Ed,

    The SeriesCollection is read only because we do not want the collection instance to change.  Why does deserializing the view model need a settable SeriesCollection?  When you deserialize can you not clear the existing SeriesCollection and add the deserialized Series objects back into it?  I'm also not sure how you binded to this collection since it has no setter and it is not a DependencyProperty.

    About the only way I've seen to dynamically create series at runtime from the view model has been to do something like this: http://stackoverflow.com/questions/18857830/xamdatachart-with-unknown-number-of-series

Children