所以我刚刚创建了一个有事件的基本画布。然而,当我运行此代码时,该事件从未真正命中。我用 C# 编写 Metro 应用程序。我做错了什么?
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Canvas HorizontalAlignment="Left" Height="673" VerticalAlignment="Top" Width="1346" Margin="10,85,0,0" PointerMoved="Canvas_PointerMoved"/>
</Grid>
这是我的 C# 代码
public MainPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Canvas_PointerMoved(object sender, PointerRoutedEventArgs e)
{
Debug.WriteLine("hit");
}