Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to programmatically add User Control to Silverlight Grid Column?

I have a User Control that I need to programmatically add to a Silverlight Grid t a specified Row and Column index. The requirements are such that I will need to insert at arbitrary indices, such that pure databinding is perhaps not ideal.

I would prefer not to have to create the grid from scratch in the code behind. Can this be done? Anyone with example?

like image 651
PortageMonkey Avatar asked Dec 09 '09 02:12

PortageMonkey


1 Answers

Use Grid.Children.Add to add it to the grid, and Grid.SetRow and Grid.SetColumn to set the row and column index. E.g.

Grid.SetRow(myControl, 3);
Grid.SetColumn(myControl, 4);
myGrid.Children.Add(myControl);
like image 82
itowlson Avatar answered Nov 14 '22 01:11

itowlson