This might be something of a general WPF question, but any assistance from the experts on this site would be appreciated.
I have employed some samples from these forums (e.g. dynamic series binding, strip lines). The XamDataChart XAML definition is consequently fairly verbose.
I also have a XamZoombar which has a secondary chart as its HorizontalPreviewContent. This is essentially the exact same XamDataChart as defined for the primary chart with just a few changed properties.
My XAML therefore has a lot of duplication. Can I template the chart and then create "instances" of the template at the appropriate locations? Or should I wrap the chart object as a UserControl and compose the UI appropriately? I'm not sure what the best approach should be and experimentation will prove time-consuming!
Many thanks
HtD
Hello HtD,
I have been looking into your question and based on your description I can suggest you stick with a common UserControl where you can create and customize the XamDataChart and provide the data to it. This way you will be able to reuse all of the code without duplicating the same code. Although using templates you will still be able to create a common design to your chart, some of your dynamic code and adding of the series still will be duplicated. This is why I believe that in your case may be more effective if you use the second approach that you mentioned, and wrap the chart object as UserControl, especially if you have large amount of common customization for both of the charts.
Please let me know if you have any additional questions on this matter.
Elena
Thanks very much. I will look into this.