Hello Charlie,
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.
Thanks again.
Hello Stefan,
I solved my problem. Thanks for you reference.
I can suggest you see this forum thread from StackOverflow:
http://stackoverflow.com/questions/248362/how-do-i-build-a-datatemplate-in-c-sharp-code
where it is discussed how to create DataTemplates in code.
Hope this helps you.
Thanks for you reply. Maybe I didn't explain my issue clearly. The current situation: I have a xamDataChart, in this chart, I have some column series, but I don't know the series's count, because series are dynamic created according to some condition(the legends are also dynamic created), so I want to implement this in code-behind(all xaml code convert to C# code),dynamic created in run time.
By now,I have converted the series xaml code to C# code, but the legend xaml code(pasted in my first question) is hard to convert to C# code, I don't know how to write this xaml code using C#. So can you help me to convert the above xaml code to C#? Thanks very very much~~~
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I defined the DataTemplates as Resources in the Grid and set them to the ColumnSeries, when a Button is clicked. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply