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...
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
A 770 line code behind file to do MVVM databinding? That is completely unacceptable!
I was able to bind to the SeriesCollection by passing a reference to the to the view into the viewmodel's constructor
. But when I deserialize the viewmodel, I cannot pass arguments in the constructor, and this is causing the problem.