OnMouseMove does not fire on canvas in WPF

后端 未结 2 1611
时光说笑
时光说笑 2020-12-16 14:45

I have done my custom chart control and I want to draw a simple cross following the cursor. The chart is implemented as a PolyLine over a Canvas and I\'m drawing two lines c

2条回答
  •  暖寄归人
    2020-12-16 15:18

    This is wierd and I dont know why...

    FrameworkElement.MouseMove works only if the region has some explicit background brush \ fill set.

    In your case set the Canvas.Background="Transparent", it should work.

    There is another fix to this as well... WPF Not sending MouseMove events after CaptureMouse();

    This could be possibly because the HitTest depends upon colored pixels and their feedback.

    Whatever it is, its something not documented over MSDN and is confusing for many UI designers.

提交回复
热议问题