Silverlight mouse and keyboard events Precautions

Mouse:

     In Silverlight controls, you knock the mouse, always able to knock out a lot of events, but there are some events are invalid.

     For example: Draw a circle Ellipse element, it is only fixed only events:

  Loaded, MouseEnter, MouseLeave, MouseLeftButtonDown, MouseLeftButtonUp, MouseMove

  But I try to drag the circle by MouseLeftButtonDown, MouseLeftButtonUp, MouseMove through time, unable to complete the effect, the result is put on a Canvas tag element on the outside of the element to get it, but it did not drag so gorgeous.

 

Keyboard point:

     As the circle Ellipsek no KeyDown event, so I add KeyDown in its outside CanVas, the same is not valid.

     To add a TextBox Internet was the same, so that the inside of the controls to get the focus in order to trigger the KeyDown event.

  In fact, the KeyDown event as long as the root node plus years on the line . I saw that it is not CanVas, nor the Grid,

Turned out to be UserControl, after adding, keyboard events came out.

Reproduced in: https: //my.oschina.net/secyaher/blog/274284

Guess you like

Origin blog.csdn.net/weixin_34092370/article/details/91966744