The coordinate positions are used to place elements in a Canvas panel. When you want to place an item in a Grid, set the Row and Column while placing it. For StackPanel, WrapPanel, and UniformGrid panels, you won't need to specify any other property as those will be stacked automatically.
The following example shows you how to dynamically add an element in a Grid, at a specific cell position, specified by the Row and Column index:
// set the Row and Column to place the element Grid.SetRow(element, rowIndex); Grid.SetColumn(element, columnIndex); // add the element to the Grid gridPanel.Children.Add(element);
If you want to span the element to multiple rows and multiple columns, you can do so by calling the Grid.SetRowSpan and Grid.SetColumnSpan methods, as shown in the following code:
Grid.SetRowSpan(element, noOfRowsToSpan); Grid.SetColumnSpan(element, noOfColumnsToSpan);