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


Hi guys,

I’ve found an issue with my custom ChartModifier that does it’s own panning.
I have implemented overrides to the following events from ChartModifierBase:
OnModifierMouseDown – just sets a boolean that is used on mouse move
OnModifierMouseUp – clears that boolean
OnParentSurfaceMouseLeave – also clears the boolean
OnModifierMouseMove – does all of the work

Now please note that on my Chart, I have a single Y-axis on the right-hand-side of the data grid.
The bug I believe is when the mouse moves beyond the left-hand side of the data grid in the small (20px or so) space between the data grid and the end of the bounds of the SciChart. See screenshot for where I mean.
When the mouse enters this zone, I expect an OnParentSurfaceMouseLeave event to fire but it does not. What also does not fire anymore in this zone is any of the other events – so I can click-drag from my data grid area, move the mouse into this zone and release the left-mouse. Moving the mouse back inside the data grid area, my Pan chart modifier thinks that the mouse is still held down (my boolean is still set to true) because the OnModifierMouseUp did not fire.

I believe the ModifierSurface bounds perhaps aren’t being set correctly.

Please note that on all other boundaries but the left-most one, this bug is non-reproducible and so is not an issue.

Just a minor issue, but one I thought is worth a mention anyway.


  • You must to post comments

Hi Miles,

Are you aware of WPF Snoop? A tool for inspecting the visual tree and debugging WPF applications? I’ve attached a screenshot to show me snooping SciChart to determine the bounds of the parent surface.

As you can see the SciChartSurface extents to the bounds of the user control and there is a padding inside of 20,20,15,15. This means the mouse leave event won’t fire so long as the mouse is within that red highlighted area.

To work around this, you can do the following. In your Xaml declare a border and place the SciChartSurface inside it with a padding of zero, and margin of 20,20,15,15

<Border Background="#333">
   <s:SciChartSurface Padding="0" Margin="20,20,15,15">
       <!-- etc ... -->

This will have the effect of making the 20 pixel border outside of the parent surface so when the mouse moves into this region, OnParentSurfaceMouseLeave will correctly fire.

If on the other hand you want to know if the mouse is inside the chart grid area, or either axis, you can use some aspects of the hit-test API to do this.

Please see this forum post, specifically the “HitTestModifier” which demonstrates where a mouse click is.


Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.