Pre loader

Dynamic create zoom/pan modifier left button sticky

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

0
0

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 });
OnPropertyChanged(nameof(ModifierGroup));
}

Version
5
  • 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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies