开发者

Making control with attached property in code behind (WPF)

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜