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?
Grid holdingGrid = new Grid();
int row = 0;
for (int i = 0; i < 10; i++) {
Expander expander = new Expander();
holdingGrid.RowDefinitions.Add(new RowDefinition());
holdingGrid.Children.Add(expander);
Grid.SetRow(expander, row);
Grid.SetColumn(expander, 0);
row++;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With