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


I have a problem with dynamically adding/removing zoom/pan modifier.
Initially when chart is created, it add zoomExtend and xyRubberBand modifier, so the chart zooms on left button drag. I added a button in my app so when the button is clicked, xyRubberBand is removed and ZoomPan modifier is added (with execute on MouseLeftButton); so when I click button, I do see pan behavior, problem is, when mouse left button up it still stays in pan mode, which means pan continues even with left button up, I found if I click right mouse button at this point the pan behavior stops.
The code to dynamically add/remove modifiers is below

public void AddPan()
var rubber = ModifierGroup.ChildModifiers.FirstOrDefault(x => x is RubberBandXyZoomModifier);
var pan = ModifierGroup.ChildModifiers.FirstOrDefault(x => x is ZoomPanModifier);
if (rubber != null) ModifierGroup.ChildModifiers.Remove(rubber);
if (pan == null) ModifierGroup.ChildModifiers.Add(new ZoomPanModifier() { ExecuteOn = ExecuteOn.MouseLeftButton, IsEnabled =
true });

  • sally an
    I found the issue – the modifier needs to be inserted to top of the modifier group childmodifiers, thanks.
  • Oleksandr Shvets
    Hi Sally, Thanks for your inquiry. I am glad you’ve found the solution! If you have any further questions please feel free to ask. With best regards, Oleksandr
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.