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
130
XamDataChart LegendItem Visibility
posted

I have a XamDataChart in a ContentPane and a Legend in another ContentPane. When the chart is visible (and on startup) the LegendItems show, when the chart is not visible they do not show. I have a LegendItemTemplate to override the Series.Visibility binding but I am unable to make the LegendItems visible when the chart is not.

I used Snoop to identify that while the Visibility property on the ContentControl of each LegendItem is set to Visible the IsVisible readonly property is set to false. The Legend is still visible but the LegendItems are not.

  • 130
    posted

    This is a screenshot of Snoop on the ContentControl that hides the LegendItem. All of the "(ContentControl) 9" objects represent a LegendItem.

    A bigger issue may be that the LegendItem bindings are being wiped out (all of the yellow rows on the right indicate a changed property of the LegendItem's ContentControl when the chart is no longer visible).

  • 130
    posted

    I need some way to have a single legend for multiple charts, without duplicating legend items (all the charts have the same data objects), and without the legenditems disappearing when one of the charts is not visible. 

    I would like to be able to show a legend with a single set of legenditems in it and have that always visible. There are currently 5 charts that may be all visible at the same time or displayed in tabs. I need a common legend for all of these but without 5 of each legend item.

    Currently I have all the individual legends in grid columns and I am binding the Visibility property to the IsVisible property of the chart itself. While this works to always show a legend no matter what chart is visible I end up with really bold text due to rendering items on top of each other.

    NOTE: I have not cleaned the styling up yet to accommodate small charts. 

    If I could solve my original issue then all would be well.