locked
Can i use x:ConnectionId in my c++ metro app?

    Question

  • i just heard that there is a property ConnectionId in c#,so i want to use it in my c++ metro app, is this allowed and how to use?
    • Edited by waot Tuesday, January 8, 2013 2:23 AM
    Tuesday, January 8, 2013 2:22 AM

Answers

  • The ConnectionId is used in C++ to connect generated code to XAML elements similar to how it is used in C#.

    Generally this is not something that you would use directly but it is used by the tools to connect the XAML description to the app's custom code. You can see this used in the .g.h and .g.hpp files generated for your app. See the remarks for the IComponentConnector interface for more details on how this works.

    Why do you want to use this directly and what specifically do you want to achieve by doing so?

    --Rob

    • Marked as answer by waot Tuesday, January 8, 2013 5:26 AM
    Tuesday, January 8, 2013 3:03 AM
    Owner

All replies

  • The ConnectionId is used in C++ to connect generated code to XAML elements similar to how it is used in C#.

    Generally this is not something that you would use directly but it is used by the tools to connect the XAML description to the app's custom code. You can see this used in the .g.h and .g.hpp files generated for your app. See the remarks for the IComponentConnector interface for more details on how this works.

    Why do you want to use this directly and what specifically do you want to achieve by doing so?

    --Rob

    • Marked as answer by waot Tuesday, January 8, 2013 5:26 AM
    Tuesday, January 8, 2013 3:03 AM
    Owner
  • hi Rob, in my xaml page there are ten buttons, it is a little trouble if i set each button with a click event.

    so i want to set each button a connectionid and deal with  all click events in one function.

    but now it seems a little naive for this according what you say above. perhaps i should do all the coding work myself~

    thank you, Rob.

    Best Regards!


    • Edited by waot Tuesday, January 8, 2013 5:26 AM
    Tuesday, January 8, 2013 5:14 AM