Pre loader

Sharing Mouse Events one-way

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

1
0

Hi guys,

I have two SciCharts, and a different custom modifier on each of them. I have utilised the Mouse:MouseManager.MouseEventGroup=”MySharedMouseGroup” logic to share mouse events between the two charts.

The problem is, I would like Chart A to handle its own MouseMove events, and share those to Chart B, but Chart B should handle its own MouseMove events (and those sent from Chart A obviously) but not send anything back to Chart A’s modifiers.

I have noticed that there are some base properties from UIElement called “IsMouseOver” which should let me handle this (i.e. in Chart B’s OnModifierMouseMove method it could check IsMouseOver and if false, simply return. That way, the message is still being shared between A and B, but B just ignores A’s messages), but unfortunately I find this IsMouseOver property to always be false, no matter where the pointer is.

How would you guys recommend I tackle this problem?

As an example of the problem, let’s say you have two SciCharts, each with their own RolloverModifier, and their ModifierGroup shares a MouseEventGroup “MySharedMouseGroup”.
You want one chart to display a rollover on both surfaces when the Mouse moves over it, but the other to display a rollover on just its own surface when the mouse is over it.

Cheers,
Miles

  • You must to post comments
0
0

Hi Miles,

I have an idea for you! There is a property in the ModifierMouseArgs called IsMaster. When this is true, the modifier triggered the event, else it is getting it from another modifier.

To make use of this, try the following:

// Note: not compiled this, but it demonstrates the principle
public class IgnoresSlaveEventsRolloverModifier : RolloverModifier
{
   public override void OnModifierMouseMove(ModifierMouseArgs e)
   {
      if (e.IsMaster)
      {
          base.OnModifierMouseMove(e);
      }
   }
}

Now register the IgnoresSlaveEventsRolloverModifier on your first chart and use a normal RolloverModifier on the second chart. Mouse over the first chart and both should receive the event, but mouse over the second and only the second should receive the event.

  • bstapylton
    Hi Andrew, Perfect! Two lines of code and my worries are gone. I should have had a more thorough look when exploring the ModifierMouseArgs and base classes before posting this issue. Thanks for your assistance! Miles
  • bstapylton
    Yes, this worked very well - I just throw return if the ModifierMouseArgs is not master (!e.IsMaster) in one of my modifiers and it will only perform it's MouseMove event if you interact directly with it instead of with the other SciChart. This provides exactly the functionality I was after. In fact, I was looking for a way to do this by using one of the base class properties called IsMouseOver to determine if the mouse is over the current control or not (and if not, I would assume it was not the Master and return). Thanks again, Miles
  • You must to post comments
Showing 1 result
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