SilverMouse is an open source project that adds some functionality to the I / O system of a Silverlight application. As the name of the project makes clear, the library is concentrated on working with the mouse. The first beta version of this library has been released. I ask all interested silverlivers to take part in testing this project. This will help to quickly catch the main glitches and develop
SilverMouse further.
To use this library you need:
1. Connect it
')
2. Register the MoonRainbow.Input.Mouse namespace in usings
using MoonRainbow.Input.Mouse;
3. Using extended-methods to connect event handlers to any UIElement (Attach_event_name - add handler, Dettach_ event_name - remove handler)
this.AttachPreviewMouseLeftButtonDown(MouseLeftButtonDownPreview);
this.AttachPreviewMouseLeftButtonUp(MouseLeftButtonUpPreview);
this.AttachPreviewMouseRightButtonDown(MouseRightButtonDownPreview);
this.AttachMouseRightButtonDown(MouseRightButtonDown);
this.AttachPreviewMouseRightButtonUp(MouseRightButtonUpPreview);
this.AttachMouseRightButtonUp(MouseRightButtonUp);
At the same time, it should be understood that if you set the Handled property of the event arguments to true in the Preview-handler, this will cause the corresponding event following the Preview-event to not occur.
For example:
private void MouseRightButtonDownPreview(object sender, MouseRightButtonEventArgs e)
{
// , .
e.Handled = true;
}
private void MouseRightButtonDown(object sender, MouseRightButtonEventArgs e)
{
// ,
// MouseRightButtonDownPreview e.Handled true
}
4. Set the windowless application parameter to true (initialization parameters of the plugin)
Opportunities:
- support of the right mouse button:
- PreviewMouseRightButtonDown
- MouseRightButtonDown
- PreviewMouseRightButtonUp
- MouseRightButtonUp
- extension of left mouse button support:
- PreviewMouseLeftButtonUp
- PreviewMouseLeftButtonDown
Events with the Preview prefix work like descending events. The rest as upstream events (see
“Routing Strategies” )
It is also worth considering the fact that the add-on starts working only at the moment when the first addition occurs or an attempt to delete the handler of the above listed events.
One more fact: when using this library, the context menu of the Silvrelight plugin disappears. It was intentional. In the future, work will be done on adding the ability to call the functionality of this context menu.
PS all the questions and found bugs to me in a personal or in a comment. I would be grateful for the constructive comments.