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
370
Creating series on the fly over binding
posted

Hey,

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:

ObservableCollection<MySeriesContainer>

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?