I have UserControl1 and I want to create it's instance and set attached property for it in the code behind of the other UserCo开发者_运维百科ntrol2. The other words, I have in the UserControl2:
<UserControl2>
<Canvas>
</Canvas>
</UserControl2>
And I want to do:
<UserControl2>
<Canvas>
<UserControl1 Canvas.Left="100" ... />
</Canvas>
</UserControl2>
How can I create UserControl1 with attached property in code behind of the UserControl2?
UserControl1 ctrl = new UserControl1();
Canvas.SetLeft(ctrl, 100);
精彩评论