Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to manually trigger MouseMove event for a stationary mouse
    primarykey
    data
    text
    <p>I'm implementing a 'value under cursor' readout for chart contents. Currently I am achieving this using ReactiveExtensions and subscribing to the GetMouseMove event on my chart background Grid:</p> <pre><code>private void SetupMouseover( Grid plotArea) { var mouseMove = from mo in plotArea.GetMouseMove() select new { CurrentPos = mo.EventArgs.GetPosition( plotArea ) }; mouseMove.Subscribe( item =&gt; { // Update the readout contents readoutTextBlock.Text = PositionToReadoutValue(item.CurrentPos); } ); } </code></pre> <p>And that works fine. I can move my mouse around and I get my text block updated.</p> <p>The problem is that the chart contents are being updated dynamically (moving across the screen). If I leave the mouse cursor stationary over the point, the contents beneath it change but (obviously) the readout is not updated.</p> <p>I attempted to manually trigger the mouse move by setting the cursor position to itself whenever the data in the model was updated:</p> <pre><code>private void MoveCursor() { // move the mouse cursor 0 pixels System.Windows.Forms.Cursor.Position = new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y); } </code></pre> <p>This did not trigger the callback. Setting the position to be (X-1, Y-1) DID trigger the callback, but if I immediately set the pixel back to the original location (a subsequent X+1,Y+1) this does NOT trigger the mousemove callback for either Position set.</p> <p>I also tried manually setting the readoutTextBlock on notification of my model changed based on Mouse.GetPosition(m_PlotArea) but encountered threading issues (model is update in separate thread) and also hit-test issues with m_PlotArea.</p> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload