locked
how to binding to element inside user control RRS feed

  • Question

  • Is there a way to binding to a sub element inside usercontrol using xaml?

    I with to replicate this code using just xaml.

    this.controlDisplayView.displayView.display

    where this is the window,

    controlDisplayView is the usercontrol name,

    displayView is the sub usercontrol inside controlDisplayView,

    and display is an element of displayView

    Sunday, June 2, 2013 8:39 PM

Answers

  • Hi in the UserControl expose Commands and Properties as (Dependency-)Properties (or ICommands). Bind to them.

    Regards,

      Thorsten


    • Edited by Thorsten Gudera Sunday, June 2, 2013 10:33 PM
    • Marked as answer by Lisa Zhu Friday, June 7, 2013 2:23 AM
    Sunday, June 2, 2013 10:32 PM

All replies

  • What you asking goes against pretty much every rule of why you would have a usercontrol.  The usercontrol should be able to be "self-contained".  Calling a method within the usercontrol from outside the usercontrol is never a good thing.

    Lloyd Sheen

    Sunday, June 2, 2013 10:09 PM
  • I have some tab pages and I decided to use a usecontrol in each of them.

    What should I use instead ?

    Sunday, June 2, 2013 10:18 PM
  • Hi in the UserControl expose Commands and Properties as (Dependency-)Properties (or ICommands). Bind to them.

    Regards,

      Thorsten


    • Edited by Thorsten Gudera Sunday, June 2, 2013 10:33 PM
    • Marked as answer by Lisa Zhu Friday, June 7, 2013 2:23 AM
    Sunday, June 2, 2013 10:32 PM