Wednesday, November 28, 2007

How to center a control or object within a grid within the page

I have a grid with a control in it. I want the control ( or object ) to be centered in the grid when the window is expanded. This is how I did it:

The grid

Width is set to : Auto

Height to: 705.5 (yours will be different, it is whatever you want/need)

Row 1
Row Span 1
Column 0
ColumnSpan 2

Horizontal Alignment Center
Vertical Alignment Center

Margin
<--172.176
-->2.131
(up)10
(dwn)-22.5

My control :

Width 533
Height 600
Row 0
Row Span 1
Column 0
Column Span 1
Horizontal Alignment Stretch
Vertical Alignment Stretch

Margin
<--41.25
-->48.75
(up3.25
(dwn)102.25