3

Let's say I want to position an element at the coordinates x=20, y=5 within the 3rd column of a Grid control. How do I do this? Do I need to add a Canvas panel to the column and then add the controls to it?

animuson
  • 53,861
  • 28
  • 137
  • 147
Trap
  • 12,050
  • 15
  • 55
  • 67

1 Answers1

7

You can do it that way, but have a look at this.. Attached Property

<Grid Background="Yellow">
  <Rectangle Fill="Red" Margin="20,10,0,0" Width="50" Height="30"
     HorizontalAlignment="Left" VerticalAlignment="Top" />
  <Rectangle Stroke="Green" Margin="30,15,0,0" Width="20" Height="30"
     HorizontalAlignment="Left" VerticalAlignment="Top" />
</Grid>

You can use the Margin property to simulate absolute positioning.

Not sure whether this would help you, but in any case an interesting read.

rajesh pillai
  • 8,102
  • 7
  • 43
  • 60