I take step by step Getting Started for Creating a Windows Multipoint Application
but for
Associate MultiPoint events with event handlers in the constructor of WPF window
// Preview events for Button
MultiPointTestButton.MultiPointPreviewMouseLeftButtonDownEvent += new RoutedEventHandler(MultiPointTestButtonPreviewLeftButtonDown);
MultiPointTestButton.MultiPointPreviewMouseLeftButtonUpEvent+=new RoutedEventHandler(MultiPointTestButtonPreviewLeftButtonUp);
..............................................................
and the next step I lost the way.
Can anybody help me ?
thanks !
hi mig,
mig:MultiPointTestButton.MultiPointPreviewMouseLeftButtonDownEvent += new RoutedEventHandler(MultiPointTestButtonPreviewLeftButtonDown);
This code sets up an event handler, and tells the framework that the function which will handle the MultiPointPreviewMouseLeftButtonDownEvent is the MultiPointTestButtonPreviewLeftButtonDown function. Therefore, you need to create this function, which you can do as follows:
Normal 0 false false false EN-AU X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}
// Handle Clicks on the mpButton MultiPointButton
private void MultiPointTestButtonPreviewLeftButtonDown(object sender, RoutedEventArgs e)
{
// do something here
}
At this point, you can get some information about the button that was clicked via the sender object:
MultiPointButton btn = (MultiPointButton)sender;
Notice how we cast it to a MultiPointButton - you'll need to do this too.
Then, to get information about the mouse that actually clicked on the button, you can use the RoutedEventArgs object, and cast it to a MultiPointEventArgs object:
MultiPointMouseEventArgs multipointargs = e as MultiPointMouseEventArgs;
And you can now get some information about the mouse device that clicked the button, using syntax like so:
multipointargs.DeviceInfo.ID - returns the ID of the mouse device
Hope this answers your question. happy coding!
Regards,
Greg