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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

1
1

I think this is a pretty simple question but i am not sure what i am missing.I have a toggle button on my legend that is intended to allow the users to select all the series or deselect all the series.
the button essentially goes through the Renderable series view models and set the IsSelected to either true or false, this approach however, doesn’t work. I looked at the SelectionModifier and i can see that has a protected DeselectAll method and i am thinking to leverage that to solve this use case.

what is the best solution to accomplish this? isn’t this functionality something that perhaps be standard and could just be turned on?

Version
4
Images
  • You must to post comments
0
0

Hi Joseph,

You’ll need to template the ScIChartLegend to place your button in it.

The ControlTemplate for the SciChartLegend control

The auto-generated SciChartLegend control is simply an ItemsControl. The default Control Template for the SciChartLegend is included below:

<ControlTemplate TargetType="s:SciChartLegend">
   <Border
      HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
      VerticalAlignment="{TemplateBinding VerticalAlignment}"
      Background="{TemplateBinding Background}"
      BorderBrush="{TemplateBinding BorderBrush}"
      BorderThickness="{TemplateBinding BorderThickness}"
      Padding="{TemplateBinding Padding}">
      <ScrollViewer Common:CompatibleFocus.IsFocusable="False" HorizontalScrollBarVisibility="{Binding (ScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}" VerticalScrollBarVisibility="{Binding (ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}">
         <ItemsPresenter />
      </ScrollViewer>
   </Border>
</ControlTemplate>

Once you have done that, the button must be bound to a command or behavior to iterate over all RenderableSeriesViewModels and set IsSelected = false.

That’s the only way to do it.

Best regards,
Andrew

  • You must to post comments
0
0

Thanks Andrew but i see what is going on in the code. I templated correctly and everything but i needed to also set the IsVisible flag to accomplish what i wanted. I some how thought that just setting IsSelected would handle the selection and deselection of the lines on the chart and the legend. Once i set the IsSelected as well as the IsVisible everything worked out.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.