开发者

How can I programmatically add uielements to canvas in Silverlight 4?

How can I programmatically add UIElements to canvas in Silverlight 4?

But nothing happens. When I check for the existence of the image it is there but nothin开发者_Python百科g shows.

wtf?

Button btn = new Button();
btn.Content = "Button";
Canvas.SetLeft(btn, 450);
Canvas.SetTop(btn, 100);
Canvas1.Resources.Add("btn1", btn);
Canvas1.UpdateLayout(); 


You want to use Children, not Resources.

Button btn = new Button();
btn.Content = "Button";
Canvas.SetLeft(btn, 450);
Canvas.SetTop(btn, 100);
Canvas1.Children.Add(btn);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜