locked
Attached events in Metro style app

    Question

  • Hi there,

    I have a grid with a bunch of buttons. I'm trying to attach a button click handler on a grid level using Button.Click="AnyBtnClicked" syntax. Xaml compiler doesn't like it: warning WMC0002: Unknown member 'Click' on element 'Grid'.

    Q: How can I handle button click events without attaching them to all the buttons?

    Thanks,

    MK

    Monday, September 26, 2011 12:16 AM

Answers

  • Hi MK,

    Only ButtonBase elements have Click.  Grid doesn’t have a clicked event.  You should use a pointer event (PointerPressed, PointerReleased, etc.) 

    For more information about designing touch-friendly interfaces that provide mouse functionality automatically, please see the following talk:

    http://channel9.msdn.com/events/BUILD/BUILD2011/APP-503T

    Thanks

    Raman Sharma

    Program Manager, Visual C++

    Monday, September 26, 2011 6:27 PM