SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components



I have a SciChartSurface with 193 series on it and my application needs to display a legend with 193 items. The requirement is that a legend should be located underneath the plot as a scrollable panel with items arranged in a wrap-panel fashion. The problem is that it takes a long time to render this many items because WrapPanel does not use Virtualization.

I found a 3-rd party control ( that implements virtualization in a WrapPanel. However, it is designed to work inside a ListBox/ListView and does not as an ItemPanelTemplate for SciChartLegend.

Is it possible to render LegendData in a custom control? I’ve noticed that LegendData is a ChartDataObject. However, when I bind its SeriesInfo property my ListBox is not populated.

Here is my XAML:

In my SciChartSurface I’ve added a modifier:

                        <!--  Turn this legend off because we've got a custom one below  -->
                        <s:LegendModifier GetLegendDataFor="AllSeries" ShowLegend="False" />
                        <local:ErrorBarExclusionLegendModifier x:Name="mwErrorBarExcluder" />
                        <s:TooltipModifier />
                        <local:MouseClickChartModifier RightClickPosition="{Binding RightClickPosition, Mode=OneWayToSource}" />

Then I declare a ListBox:

                ItemTemplate="{StaticResource SciChartLegendItemTemplate}"
                ItemsSource="{Binding LegendData, ElementName=mwErrorBarExcluder, Converter={StaticResource SeriesConv}}">
                        <wtk:VirtualizingWrapPanel Orientation="Horizontal" />

Since I can’t bind ItemsSource to ChartDataObject I wrote a simple converter that extracts the collection of SeriesInfo objects:

public object Convert(object aValue, Type aTargetType, object aParameter, CultureInfo aCulture)
    ChartDataObject fSource = aValue as ChartDataObject;

    return fSource?.SeriesInfo;

What am I doing wrong?

Thank you in advance for your suggestions.

  • You must to post comments

I resolved my own issue. Turned out ErrorBarExclusionLegendModifier is a local class that filters series. It updated ChartDataObject.SeriesInfo but not the object itself so the PropertyChanged event was never fired. I modified it to expose ObservableCollection instead and removed the converter. Now it works. is a useful control.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.