Hello,
My goal is to have the user select a series with a mouse click, and to see which series was selected while following the MVVM pattern. I am filling in the DataSeries using a LineSeriesSource attached behaviour.
What I tried so far is to attach to the SelectionChanged event of a Renderable series with an Interaction Trigger.
This doesn’t work:
<SciChart:SciChartSurface.ChartModifier>
<SciChart:ModifierGroup>
<SciChart:SeriesSelectionModifier >
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged" >
<i:InvokeCommandAction Command="{Binding Path=cmdSelectedSeriesChanged}" CommandParameter="{Binding Path=SelectedSeries}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
<Style TargetType="SciChart:BaseRenderableSeries">
<Setter Property="Stroke" Value="White"/>
<Setter Property="StrokeThickness" Value="2"/>
</Style>
</SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
</SciChart:SeriesSelectionModifier>
</SciChart:ModifierGroup>
</SciChart:SciChartSurface.ChartModifier>
This works, but is not what I want since it’s not MVVM:
<SciChart:SciChartSurface.ChartModifier>
<SciChart:ModifierGroup>
<SciChart:SeriesSelectionModifier SelectionChanged="SeriesSelectionModifier_SelectionChanged">
<SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
<Style TargetType="SciChart:BaseRenderableSeries">
<Setter Property="Stroke" Value="White"/>
<Setter Property="StrokeThickness" Value="2"/>
</Style>
</SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
</SciChart:SeriesSelectionModifier>
</SciChart:ModifierGroup>
</SciChart:SciChartSurface.ChartModifier>
Interaction Propety cannot be attached to SciChartSurface.RenderableSeries.
I also tried attaching the Interaction Property to an individual DataSeries, which is definitely not what I want to do, but it doesn’t work either.
/Tomasz
- Tomasz Cholewinski asked 8 years ago
- last active 8 years ago