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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Answered
2
0

Hi,
How can I get my application to do the following:

  • RubberBandXyZoomModifier execute on left mouse
  • ZoomPanModifier execute on left mouse + ctrl

I tried extending the ZoomPanModifier as such:

public class ZoomPanModifierEx : ZoomPanModifier
{
   public override void OnModifierMouseDown(ModifierMouseArgs e)
   {
      IsEnabled = (e.MouseButtons == MouseButtons.Left) && (e.Modifier == MouseModifier.Ctrl);
      base.OnModifierMouseDown(e);
   }
}

This did not work though.

Thanks in advance.

Johnny

  • You must to post comments
Best Answer
3
0

Hi Jonny,

Try testing Keyboard.Modifiers instead of e.Modifier to see if the CTRL key is pressed.

Then, try setting ExecuteOn=MouseLeftButton for the RubberBandXyZoomModifier.

Like this:

public class RubberBandXyZoomModifierEx : RubberBandXyZoomModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        IsXAxisOnly = !e.IsMaster;

        if (!(Keyboard.Modifiers == ModifierKeys.Control))
        {
            base.OnModifierMouseDown(e);
        }
    }
}

public class ZoomPanModifierEx : ZoomPanModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        if ((e.MouseButtons == MouseButtons.Left) && (Keyboard.Modifiers == ModifierKeys.Control))
        {
            base.OnModifierMouseDown(e);
        }
    }
}

Hope this helps!
Andrew

  • johnnyp112
    Thanks your solution worked.
  • Andrew
    Great :) Glad to be of help!
  • pavi1989
    Thanks for the link. This works as we expected
  • You must to post comments
1
0

Hi,

Hmm… It seems to me you should use “if” here instead:

public class ZoomPanModifierEx : ZoomPanModifier
{
   public override void OnModifierMouseDown(ModifierMouseArgs e)
   {
      if(e.MouseButtons == MouseButtons.Left) && (e.Modifier == MouseModifier.Ctrl)
      {
         base.OnModifierMouseDown(e);
      }
   }
}

Best regards,
Yuriy

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.