Pre loader

SelectedSeriesModifier on MouseHover StrokeThickness binding

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


SelectedSeriesModifier gets applied only on click (i guess that sets the isselcted). I found the ExecutesOn property that work on MouseMove.

However, I am unable to bind the strokethickness (I cannot use static/hardcoded values as strokethickness is decided by the user and I need to increase it by 1 when user hovers over the series).

Binding evaluation throws following error and crashes – WPF ‘System.Windows.Data.Binding’ is not a valid value for property ‘StrokeThickness’

                        <s:SeriesSelectionModifier ExecuteOn="MouseMove">
                                <Style TargetType="s:BaseRenderableSeries">
                                    <Setter Property="StrokeThickness" Value="{Binding Path=StrokeThickness, diag:PresentationTraceSources.TraceLevel=High}"/>
  • Andrew Burnett-Thompson
    This should be possible via a custom modifier, am talking to the team about it now. Just a question: how do you expect to deselect? When un-hovered? What is the use-case for this functionality?
  • Kapil Sinha
    i need to increase the StrokeThickness on hover so that the user can easily understand which series is highlighted. I will deselect on hover. I need this behavior as it was there before we switched to scichart.
  • You must to post comments

Hi Kapil,

At a basic level this can be achieved using the ChartModifier API.

I’ve created you a new example which sets Series.IsSelected on hover rather than on click. This is only a few lines of code.

public class HoverSelectionModifier : ChartModifierBase
    public override void OnModifierMouseMove(ModifierMouseArgs e)
        // Translate mouse point to modifier surface (required for left/top axis scenarios)
        var mousePoint = GetPointRelativeTo(e.MousePoint, ModifierSurface);

        // Call Series.HitTestProvider.HitTest to find which series is under the mouse point 
        var selectedSeries = this.ParentSurface.RenderableSeries.FirstOrDefault(x => x.HitTestProvider.HitTest(e.MousePoint).IsHit);

        // Apply the selection

    private void DeselectAllBut(IRenderableSeries series)
        if (series != null)
            series.IsSelected = true;

    private void DeselectAll()
        ParentSurface.RenderableSeries.ForEachDo(rs => rs.IsSelected = false);

Apply it like this:

<s:SciChartSurface ShowLicensingWarnings="False">
        <s:FastLineRenderableSeries x:Name="line0" Stroke="LightSteelBlue" StrokeThickness="2" SelectedSeriesStyle="{StaticResource SelectedSeriesStyle}"/>
        <s:FastLineRenderableSeries x:Name="line1" Stroke="OrangeRed" StrokeThickness="2" SelectedSeriesStyle="{StaticResource SelectedSeriesStyle}"/>
        <s:FastLineRenderableSeries x:Name="line2" Stroke="MediumPurple" StrokeThickness="2" SelectedSeriesStyle="{StaticResource SelectedSeriesStyle}"/>
        <s:NumericAxis GrowBy="0.1, 0.1"/>
        <s:NumericAxis GrowBy="0.1, 0.1"/>

public partial class MainWindow : Window
    public MainWindow()

        line0.DataSeries = GetData(1);
        line1.DataSeries = GetData(2);
        line2.DataSeries = GetData(3);

        line0.SelectionChanged += (s, e) => Console.WriteLine($"Series 0 IsSelected=${line0.IsSelected}");
        line1.SelectionChanged += (s, e) => Console.WriteLine($"Series 0 IsSelected=${line1.IsSelected}");
        line2.SelectionChanged += (s, e) => Console.WriteLine($"Series 0 IsSelected=${line2.IsSelected}");

    private IDataSeries GetData(int index)
        var xyDataSeries = new XyDataSeries<double>();
        for (int i = 0; i < 100; i++)
            xyDataSeries.Append(i, Math.Sin(i * 0.05 * index) + Math.Cos(i * 0.01 * index + 0.05));

        return xyDataSeries;

This results in the following output

enter image description here

You can find a link to SeriesSelectOnHover project on Github here.

Best regards

  • You must to post comments

Sorry @Andrew
I modified the question after posting it and it has caused some confusion.

I was able to use SelectedSeriesModifier with ExecutesOn property (set to MouseMove) – I dont need to create another modifier.

My problem right now is the crash resulting from binding for strokethickness as I cant use hardcoded value for it during onHover.

The exception that I am getting is –
‘System.Windows.Data.Binding’ is not a valid value for property ‘StrokeThickness’

Let me know if you have any ideas about it.

  • Andrew Burnett-Thompson
    I suggest opening a new question with code to reproduce the bug (please upload code to dropbox or as a zip. Exclude license files, bin/obj directories and anything proprietary from code you upload). Alternatively try my solution which works very well.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.