Gergely Kovásznai, Csaba Biró
Eszterházy Károly College
With the help of the Grid control the above mentioned layouts can be real. One of the most commonly used controls.
The following example includes the definition of a grid with two columns and three rows.
The RowDefinitions and the ColumnDefinitions are elements to define the rows or columns.
During designing and testing the value of ShowGridLines should be set True. In this case, symbolic lines are drawn in the grid when it runs.
Paste three elements into this structure.
It is important to note that the rows and colums numbering starts from zero.
<Button Content="0/0" Width="30"/>
Content=" In fact, I'm in the second row of the first column!" />
<Calendar Grid.Row="3" Grid.Column="2" />
The key will be located in the cell [0,0], because of the undefined location. In the case of Label the line is defined, so it will be located the cell [0,1], while the calendar can be found in the second line of the third column. That is why the rows and columns in proportion to share the width and height of the form. Of course, the size of each rows and columns can be adjusted precisely.
In our example the first line –height will be 20 pixels, while the first (second) and the second (third) one shares the remaining place at a ratio of 1:2.
In this case with the "auto" value the width of the zero-column takes the biggest width driver value among the driver with the content of the column.