如何在 Silverlight 中以编程方式填充网格?
我有一个网格,我试图在 Silverlight 中以编程方式创建和填充。然而,尽管我付出了努力,所有项目都默认在网格中出现“0, 0”。这就是我所拥有的:
Grid holdingGrid = new Grid();
int row = 0;
for (int i = 0; i < 10; i++) {
Expander expander = new Expander();
holdingGrid.Children.Add(expander);
Grid.SetRow(expander, row);
Grid.SetColumn(expander, 0);
row++;
}
但这仍然导致所有项目堆积在第一行和第一列中。我做错了什么?
I have a Grid I am trying to create and populate programatically in Silverlight. However, all of the items just default to spot "0, 0" in the grid despite my efforts. This is what I have:
Grid holdingGrid = new Grid();
int row = 0;
for (int i = 0; i < 10; i++) {
Expander expander = new Expander();
holdingGrid.Children.Add(expander);
Grid.SetRow(expander, row);
Grid.SetColumn(expander, 0);
row++;
}
But this still causes all of the items to pile up in the first row and the first column. What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)