You can also just add eventhandlers through the XAML:
<Page
x:Class="Test.MainPage">
<Canvas x:Name="MainCanvas" Tapped="MainCanvas_Tapped" RightTapped="MainCanvas_RightTapped"/>
</Page>
Then make sure your MainPage.cs contains a Canvas_Tapped and Canvas_RightTapped eventhandler, like this:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void MainCanvas_Tapped(object sender, TappedRoutedEventArgs e)
{
}
private void MainCanvas_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
}
}
If you don't want to type in the XAML you can also assign the eventhandlers to the Canvas after it has been initialized. In that case you need to change the MainPage constructor:
public MainPage()
{
this.InitializeComponent();
MainCanvas.Tapped += MainCanvas_Tapped;
MainCanvas.RightTapped += MainCanvas_RightTapped;
}