PointerPressed not working on left click

前端 未结 4 821
温柔的废话
温柔的废话 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:54

    FWIW, I've been facing the same issue and solved it by adding the event handler to some other control (but a button).

    In my case I had a Button wrapped around a SymbolIcon like so:

    
    

    What I did I just removed the Button wrap and replaced it with a ViewBox, then added the handlers to the ViewBox itself, everything works now:

    
        
    
    

    Note that you lose the Button visuals and effects (i.e. hover etc.), but to me that wasn't an issue. I think you can re-apply them from the stock styles.

提交回复
热议问题