Mouse events not called in VB WPF, does z-order matter?

后端 未结 2 1147
野的像风
野的像风 2021-01-26 09:14

There are many explanation in google, but I still struggling to implement mouse events.

  • I have tried to use MouseEnter=\"Canvas1_MouseEnter\" in canva
2条回答
  •  囚心锁ツ
    2021-01-26 09:48

    UI elements in WPF do not receive mouse events (without mouse capture) outside their rendered area. A Panel (like your Canvas) does not render anything outside the area of its child elements unless you define a non-null value for its Background property.

    You may set a Background for your Canvas like shown below, which makes it render the entire area defined by its ActualWidth and ActualHeight with a transparent brush:

    
    

提交回复
热议问题