Let's learn how to set height or width in a Grid in Windows Phone.
Grid: A Grid is a flexible container element that consists of rows and columns.There are various ways to set the height of rows and width of columns in the Grid.
Constant ValueWe can set the height or width in a grid using a constant value in pixels.CodeOutputAutoSetting the height or width to “Auto” shows the real flexibility of the grid. Setting the height/width to Auto will automatically adjust the height/width depending on the elements present inside the grid.CodeOutputStarStar (*) is equivalent to ratio in a grid. For example:This code will divide the screen into two parts. The first row will consume 2/3rd of the total space and the second row will consume 1/3rd of the space.Note: * is just a shorthand for 1*. We can use * instead of 1* and it will produce the same results.The code written above will be same as this one.OutputUsing these togetherHere is an example where we are using these 3 methods together.CodeHere the 0th row will have a constant height of 70 pixels, 1st row will have the height 200 pixels because the height is set to Auto and the content placed inside the row is 200 pixels in height, the 2nd row will consume up all the leftover space in the grid.Output
Printing in C# Made Easy