如何在代码中设置Grid.Row和Grid.Column? [英] how can i set the Grid.Row and Grid.Column in Code?

查看:132
本文介绍了如何在代码中设置Grid.Row和Grid.Column?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中将文本框添加到网格中.如何在代码中设置 Grid.Row Grid.Column ?

I add a text box to a grid in code. How can I set The Grid.Row and Grid.Column in code?

TextBox txt = new TextBox();
txt.Name = "MyTextBox";
MyGrid.Children.Add(txt);

推荐答案

Grid.SetColumn(txt, 1);
Grid.SetRow(txt, 2);



您还可以SetColumnSpanSetRowSpan相同的方式进行操作.只需键入Grid.,然后intellisense就会指导操作.



You also SetColumnSpan and SetRowSpan the same way. Just type Grid., and intellisense will guide the way.


这篇关于如何在代码中设置Grid.Row和Grid.Column?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆