I have a XamDataChart here, and the user would be adding data series on the fly. (click something in another view and say plot this). So, the number of series in the chart would be changing dynamically from 0 to any. Series types would be also dynamic. The property I plan to bind to is structured like this:
each MySeriesContainer would contain ObeservableCollection<MySeriesBusinessObject>
Is there a way to do it in the correct MVVM way, with binding and templating? I tried to search if I can use hierarchical data templates but found nothing, and trying to bind Series property over the converter (which would dynamically create the series depending on the collection of containers) causes a compile error :
error MC3065: 'Series' property is read-only and cannot be set from markup.
I think I would probably need to subclass the xamDataChart class, add a dependency property there, and programmatically populate all the things there, but would there be a nicer way?
Thank you for your post. I have been looking into it and I can suggest you see this forum post:
where Graham shared a workaround and sample for the XamChart. You can follow it to achieve the same functionality in the XamDataChart.
Thanks. I tried adapting this, but ended up writing my own wrapper control, which adds and removes series from code behind.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.