Share via


Adding a Mouse Control

To add a control to the new window to handle MultiPointClick events, add a control that implements the IMultipointMouseEvents interface. The Microsoft.Multipoint.Sdk.Controls namespace provides the MultipointButton control. By implementing the IMultipointMouseEvents interface, these controls can monitor and handle mouse device events.

To add a MultiPoint Mouse control

  1. Import the namespace in your Window1 code, as follows:

    using Microsoft.Multipoint.Sdk.Controls;

  2. Add a reference to this namespace in the Window1.xaml file as follows:

    <Window
      x:Class="MultipointBasicApp.Window1"
      xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mp="clr-namespace:Microsoft.Multipoint.Sdk.Controls; assembly=Microsoft.Multipoint.Sdk.Controls"
      Title="Window1"
      WindowState="Maximized">
    

    Because the system pointer is hidden (that is, it is not completely disabled) you should set the WindowState to Maximized to prevent the system pointer from clicking other windows when it is outside the application window area.

  3. Add a MultipointButton object to the window by adding the following code to the Window1.xaml file:

    <Grid>
        <mp:MultipointButton
          Name="mpButton" 
          Content="Click Me" 
          Click="mpButton_Click" />  
    </Grid>