Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
Posted
Updated 1-Nov-10 23:38pm
v4

1 solution

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


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900