小编Arm*_*yan的帖子

Xaml和事件不起作用

所以我刚刚创建了一个有事件的基本画布.然而,当我运行此代码时,事件永远不会被击中.我正在用c#写地铁应用程序.我做错了什么?

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <Canvas HorizontalAlignment="Left" Height="673" VerticalAlignment="Top" Width="1346" Margin="10,85,0,0" PointerMoved="Canvas_PointerMoved"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)

继承人我的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");
    }
Run Code Online (Sandbox Code Playgroud)

c# xaml

2
推荐指数
1
解决办法
159
查看次数

标签 统计

c# ×1

xaml ×1