PointerPressed not working on left click

前端 未结 4 782
温柔的废话
温柔的废话 2021-01-01 16:27

Creating Metro (Microsoft UI) app for Windows 8 on WPF+C#, I met difficulty with PointerPressed event on a button. Event doesn\'t happen when i perform left-click (by mouse)

4条回答
  •  孤城傲影
    2021-01-01 16:39

    The solution is pretty simple: these events have to be handled not through XAML but thorugh AddHandler method.

    SomeButton.AddHandler(PointerPressedEvent, 
    new PointerEventHandler(SomeButton_PointerPressed), true); 
    

提交回复
热议问题