= Chapter 8 Notes =

Title: '''Code and XAML in harmony'''

== Summary ==

This chapter shows how to create interactions between code and the elements in a XAML file. 

=== Programming Concepts Summary ===

 * Elements in a XAML file are instantiated with a parameter-less constructor.
 * To over come this we (seldom) use: 
   * {{{x:Arguments}}}
   * {{{x:FactoryMethod}}}
 * Custom XAML-based views

== Programs ==

=== ParameteredConstructorDemo ===

Page 159.

Concepts:

 1. Shows how to include parameters in XAML.
 1. The number and type of parameters must match an existing constructor.

Classes: 

No new classes

=== FactoryMethodDemo ===

Page 159.

Concepts:

 1. Shows how to create an object using a FactoryMethod.

Classes: 

No new classes

=== XamlClock ===

Page 161.

Concepts:

 1. Shows a better approach to accessing XAML object/elements by giving them a name.
 1. x:Name="..." is introduced and the text name must meet C# naming rules. 
 1. You can find the "magic" in the generated file: XamlClockPage.xaml.g.cs
    1. Every x:Name attribute becomes a private field in this generated code. 
    1. Objects named with x:Name will only be available after the call to InitializeComponent.
 1. Includes the concept of a Timer and an OnTimerTick() handler. 

Classes: 

No new classes


=== PlatformSpecificLabels ===

Page 164.

Concepts:

 1. Shows how to create a platform specific Label - but the first go, won't allow you to x:Name them. 
 1. Also all the Labels will be created, but only one of them will be assigned to the ContentPage default value - Content. 
 1. Also, ContentPage.Content is a View, and consequently the x:TypeArguments="View" - of course this is ok because Label inherits from view. 
 1. The solution is to push the OnPlatform into the Label as shown int the final version. 


Classes: 

No new classes


=== ColorViewList ===

Page 168.

Concepts:

 1. CustomViewList shows how to create a custom view that can be used over and over again. 
 1. Shows how the CustomViewList has a string property color that uses a Converter 
 1. Shows how to use the CustomerViewList in the main XAML page
 
Classes: 

No new classes


=== XamlKeypad ===

Page 172.

Concepts:

 1. Assign handlers in XAML
 
Classes: 

No new classes

=== MonkeyTap ===

Page 176.

Concepts:

 1. An actual game that brings together all the things we have learned. 
 
Classes: 

No new classes