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?
- Joseph McClean asked 6 years ago
- You must login to post comments
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.
- Joseph McClean answered 6 years ago
-
thanks, it solves the problem for me.
- You must login to post comments
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
- Andrew Burnett-Thompson answered 6 years ago
- You must login to post comments
Please login first to submit.