To start with, our project is based on clear MVVM, so we don't want to write any code behind.
Now, we need to present a collection of data, but the number of series is unknown. GroupBy seems to work fine, but our data collection changes often, so using grouping as a resource appears to be a problem.
I've prepared a sample project which illustrates what I'd like to achieve. Broadly speaking, I'd like to be able to refresh data in the chart after collection of data is reloaded.
Is XamDataChart useful in this scenario?
Hello Luk,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I have modified the sample, so now the DataContext is set in the code-behind. I basically create an instance of the VM class and set it to the Window's DataConetext. I also changed the Bindings, so now they used the DataContext instead of the StaticResource. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hello Stefan.
Thank you very much for your answer. I'm currently testing the solution. It's very helpful and works as I expected.
I wonder now if it's possible to set the DataContext in code-behind?
I will appreciate any suggestions.
Luk
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into it and I modified the sample you have sent, so now it works as you want. Basically I added a GroupBy Property in the ViewModel and bound the XamDataChart to it as Graham has explained here:
http://ko.infragistics.com/community/forums/t/64503.aspx
Please let me know if this helps you or you need further assistance on this matter.