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
2085
Horizontal Wrapping Legend Display
posted

I want the feature described and implemented here:

http://es.infragistics.com/community/forums/t/71133.aspx

However, the series associated with my legend are dynamically created in the code behind and can change, so having the XamDataChart's Load event trigger reconstruction of the display content will not work as shown in the example.  How can I modify the above example to work with series created dynamically in the code behind?

  • 34690
    Verified Answer
    Offline posted

    Hello Gary,

    Thank you for your post.

    I have been investigating into the requirement that you are looking to achieve, and I have created a sample project that is heavily based on the one that is in the forum post that you have referenced. The difference is that the Legend's items are now a custom user control which has a property for the Series. Everything else is the same, from the re-template of the Legend to the addition of the WrapPanel to it as well.

    I would recommend that you handle the XamDataChart.Series.CollectionChanged event and check the e.NewItems collection, where e is the event arguments of the CollectionChanged event. For each series in this collection, you can create a new custom legend item, pass the series to that Series property, and then obtain the WrapPanel from the Legend using the Infragistics.Windows.Utilities class and its static method GetDescendantFromType. Then, you can add this new legend item to the wrap panel's Children collection.

    I have attached a sample project to demonstrate the above.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamDataChartDynamicSeriesCase.zip