Suppose I have a several usercontrol like:
uc2 include uc1 in xaml like
<my:uc1 x:Name = "myuc1" />
then in a new usercontrol code behind, I want to create instance of uc2 and access uc1 like:
uc2 mycontrol = new uc2(); uc2.myuc1.DataContext = myViewModel; ....
I got error because myuc1 is not accessible in code behind, but I can access myuc1 in uc2 code behind! Not sure why.
the error message said: uc2 does not contain a definition for 'myuc1'
how to resolve this problem?