Scichart Legend won't consume mouse activity - wpf

I have a realtime scrolling chart with a legend. The legend works as expected but when the legend is clicked the mouse click propagates to the Scichart surface below, this is problematic as the surface is also setup to zoom and pan. When a series IsVisible is toggled through the legend the surface will also change to pan or zoom from the mouse activity.
From the How To Add Mouse Interaction to Scichart article it explains ChartModifier Precedence (Handled Events) in this section "...the first modifier that handles an event marks it as e.Handled. Subsequent modifiers will not receive the event". This doesn't seem to be the case, the LegendModifier gets handled but so does the ZoomPanModifier.
<SciChart:SciChartSurface.ChartModifier>
<SciChart:ModifierGroup>
<SciChart:LegendModifier x:Name="mainLegend" GetLegendDataFor="SelectedSeries"
MouseEnter="mainLegend_MouseEnter"
MouseLeave="mainLegend_MouseLeave"
PreviewMouseLeftButtonDown="mainLegend_PreviewMouseLeftButtonDown"
MouseLeftButtonDown="mainLegend_MouseLeftButtonDown"
ReceiveHandledEvents="False"/>
<SciChart:MouseWheelZoomModifier x:Name="mouseWheelZoomMod" XyDirection="XDirection" ReceiveHandledEvents="False"/>
<SciChart:ZoomPanModifier x:Name="zoomPanMod" ExecuteOn="MouseLeftButton" ReceiveHandledEvents="False"/>
</SciChart:ModifierGroup>
I've ensured ReceiveHandledEvents="False" for all the modifiers. Also tried an assortment of events on the legendmodifier: MouseLeftButtonDown, PreviewMouseLeftButtonDown, MouseEnter and MouseLeave but none of these ever fire.
Is it possible to stop the mouse activity for the Legend propagating to the surface below/other modifiers?

Related

Detect mouse click events while ignoring mouse movements in a windows console

I have a WSAWaitForMultipleEvents based loop, that (in addition to other stuff), triggers on keyboard and mouse events. Firstly setting:
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
And then using:
GetStdHandle(STD_INPUT_HANDLE);
As an event added to WSAWaitForMultipleEvents .
Now this is working fine but I'm really only interested in the mouse position when clicked. But naturally it is triggering for mouse movement as well. Is there any way of excluding mouse movement from the event such that WSAWaitForMultipleEvents will only awaken on mouse click and will ignore mouse movement?
Is there any way of excluding mouse movement from the event such that WSAWaitForMultipleEvents will only awaken on mouse click and will ignore mouse movement?
No. Using ENABLE_MOUSE_INPUT means that the console handle satisfies the wait on any mouse activity within the console window while the window is focused. That includes both mouse movements and mouse clicks. The documentation even says as much. So, you will just have to receive and discard the console events that you are not interested in.

Resize of SVG element mouse losing "grip" on edge

I am trying to construct some SVG shapes which should be resize-able along one or more edges.
The way I do this is by creating an additional shape on top of the shape which I want to be able to resize. I use this shape to indicate to the user that an edge can be clicked on and dragged. This shape tends to be a line that lights up once the user moves their mouse over it and I change it's position while resizing the main shape.
Using a combination of the mousedown, mousemove and mouseup events, I get the mouse's current position and adjust the shape accordingly.
All seems to work. However, what I can't seem to figure out is that should I move my mouse a little bit too quickly, while dragging the edge, it seems as though the mouse looses track of the event and the dragging of the edge fails. At this point I am have to find the edge again and restart the process.
Any idea how to either stop the mouse from losing the edge while dragging? Or perhaps slow down the event so as not to allow the mouse to jerk into any one direction too fast?
I have created a a sandbox here to demonstrate the issue.

handle Multi touch and mouse events with single event -WPF

I need to provide panning and zooming capabilities to my image in WPF. I have followed the below link and it works fine for Touch screen based system.
Multi touch with WPF . But what it doesn't work with ,mouse events. such as scrolling the mouse wheel to zoom or rotating the image using mouse. below are my questions?
Is there any possibilities to achieve both mouse and touch events by means single event?
IF yes how to do that?
If it is not possible, Why?
There are no such Common thing except the click events like MouseLeftButtonDown,MouseDown ... You have to Implement your own logic for Touch and Mouse Based Interaction.
Because they are not the same
Take a touch and drag, and a click and drag, superficially the same
But a click can be left, right, middle, special, it can be multiple buttons at once, none of that has anything to do with a touch
likewise a touch pinch has no meaning as mouse scroll wheel event
So you need to capture the different Events and convert them into a meaningful command that the VM can perform

WPF drag rectangle with touch

I have a WPF app with a canvas inside a ScrollViewer. On the canvas I have some rectangles that I drag along a timeline (left-right). This works fine with a mouse, but on a touch screen I get weird behavior if the canvas is wider than the main form. First, when you begin to drag the rectangle, the canvas pans until it has scrolled to the limit, then the rectangle starts to move. I doesn't do this when using a mouse.
Another strange this is that if I pan/drag the canvas (using touch) to the limit of the scrollviewer, the main form compresses by 20-50 pixels on the side opposite of the pan direction. It springs back to shape as soon as you stop dragging. What's going on here and how do I disable this?
It seems that this has to do with ManipulationBoundaryFeedback, but I don't understand exactly how...
EDIT:
So I was able to get a little further by setting the scrollviewer panningmode to PanningMode.None in the rectangle TouchDown handler and then setting it back to PanningMode.Both in the TouchUp handler. This solved the problem of the canvas panning to the limit before the rectangle would move.
Well, I finally got my app to work with touch. As I mentioned above, setting the PanningMode to None on the TouchDown event eliminated the problem with the ScrollViewer. Setting it back to Both in the TouchUp event re-enabled it. What this means is that I can't drag the rectangle past the point where the ScrollViewer would start panning, but in my case this was not a problem.
I also had some issues with the MouseLeftButtonDown event firing during the TouchMove event so I removed it during TouchDown
-= new MouseButtonEventHandler(drag_start)
and re-added it back during TouchUp to eliminate the glitchy behavior.
+= new MouseButtonEventHandler(drag_start)
Maybe this will help someone in the future...

detecting vertical mouse motion on a horizontal slider

I'm using a horizontal slider in WPF, but would like to also perform some action if the mouse is moved vertically (like change the brightness of some control).
I tried responding to MouseMove, but I don't get an update when dragging the slider, if the mouse moves purely vertically - my function only gets called when the slider actually moves.
You could attach a handler to the slider's PreviewMouseMove event.

Resources