Chapter 17 Notes
Title: Mastering the Grid
Summary
So much ado about Labels and the text in them.
Programming Concepts Summary
Concept |
Page |
Grid |
Pretty much everywhere |
Using the Grid for orientation changes |
484 |
Programs
Program SimpleGridDemo
Page 459.
Concepts:
- Table like layout
- Rows/Columns
- Column (and Row - not covered) spans
- Sizing
Classes:
- Grid
Note:
By Page 463, you have been introduced to all the public properties and methods defined by Grid.
Program SimpleGridDemo
Page 459.
Concepts:
- Table like layout
- Rows/Columns
- Column (and Row - not covered) spans
- Sizing
Classes:
- Grid
Program GridCodeDemo
Page 465
Concepts:
- How to do it in code!
- Not as important or aesthetically pleasing.
No new classes.
Classes No new.
Program GridBarChart
Page 467
Concepts:
Adding a list of views to a grid (cool thing actually) pay attention to the code
Make sure to turn the phone for a better view - remember Xamarin automatically allows rotation.
No new classes.
Program GridAlignment
Page 471
Concepts:
- Survey of alignment options within a cell.
- Start
- End
- Center
No new classes.
Program SpacingButtons
Page 474
Concepts:
This program equally spaces three vertical buttons and three horizontal buttons. The first three buttons occupy a three-row Grid that takes up much of the page, and the three hori-zontal buttons are in a three-column Grid down at the bottom of the page.
All in XAML - just review.
No New classes.
Program GridCellDividers
Page 475
Concepts:
Creating cell dividers (out of cells yuk). Notice the deceptive Grid.RowSpan and Grid.ColSpan attributes.
Dividing the GridLength in the ResourceDictionary.
No New Classes.
Program GridCellBorders
Page 478
Concepts:
- Borders again borders out of box views. Weird!
A nicer way to layout grids see:
<Grid Grid.Row="1" Grid.Column="1"> <Label Text="Cell" /> <BoxView Style="{StaticResource topBorderStyle}" /> <BoxView Style="{StaticResource bottomBorderStyle}" /> <BoxView Style="{StaticResource leftBorderStyle}" /> <BoxView Style="{StaticResource rightBorderStyle}" /> </Grid>
No new classes.
Program KeypadGrid
Page 481
Concepts:
- This is a keypad example. How does yours compare?
Why use StyleId instead of Text? Well, you might (just for instance) want to use a different character than a decimal
No new classes.
Using the grid layout for orientation changes
This deserves a section all its own. This is one approach to orientation changes. Portrait vs. Landscape
Program GridRgbSliders
Page 485
Concept:
Make two GridLayouts, one for portrait and one for landscape
- Add some code behind to make changes when the orientation changes.
Review the code on page 486.
No new classes.