Differences between revisions 1 and 13 (spanning 12 versions)
Revision 1 as of 2016-09-12 21:07:40
Size: 426
Editor: scot
Comment:
Revision 13 as of 2016-09-13 00:04:15
Size: 2170
Editor: scot
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Chapter X Notes = = Chapter 7 Notes =
Line 3: Line 3:
Title: '''Deepter into text''' Title: '''XAML vs. Code'''
Line 7: Line 7:
So much ado about Labels and the text in them.  * XAML is a better way to write up the "view" part of MVVM.
 * XAML is used to write the tree-structured visual user interface
Line 9: Line 10:
=== Programming Concepts Summary ===
Line 11: Line 11:
|| '''Concept''' || '''Page''' || == Concepts Not in programs ==


'''Converter Classes'''

Page 134

Below the {{{Color}}} class has a {{{TypeConverter}}} attribute added. Attributes in this context means that the defined attributed class is added to the decorated class. That means that you may have additional properties because of the decoration. You might say that Color now has a TypeConverter object that is instantiated with a Type - in this case the:
{{{typeof(ColorTypeConverter)}}}

This, of course, means that Color has additional functionality! We'll learn more about this later!

{{{#!csharp
[TypeConverter (typeof(ColorTypeConverter))]
public struct Color
{
    …
}
}}}

'''Property-[Element|Attribute] Syntax''':

Page 136

This section spells out how to translate some of the code we are used to writing into XAML. Specifically it identifies how XML elements and attributes map to objects and contents.

 * {{{<Frame ...> ... </Frame>}}} is a ''object element''
 * {{{<Frame.Content> ... </Frame.Content>}}} is a ''property element''
 * In {{{<Frame VerticalOptions="Center" ...> ... </Frame>}}}, {{{VerticalOptions}}} is a property attribute.

'''XAML Compiler'''

Page 145

You can force your output to compile the XAML instead of using it directly. This saves time and space, but is new and therefore suspect. Add the following line to your Assembly.cs file in the properties folder.

{{{#!csharp
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
}}}
Line 15: Line 53:
=== Program Baskervilles === === ScaryColorList ===
Line 17: Line 55:
Page 41. Page 146.
Line 21: Line 59:
 1. Shows that text wraps inside a label be default.
 1. Shows the use of Device.OnPlatform for padding.
 1. Shows how to do OnPlatform in XAML
 1. Shows how to nest object elements, property attributes and property elements properly.
 1. Shows code behind concepts
 1. introduces the concept of a default property (p. 151) and the {{{ConntentPrpoertyAttribute}}}.
Line 26: Line 66:
 1. Label is demonstrated.  1. OnPlatform class was used (as a variation of the {{{Device.OnPlatform(...)}}})
 1. ... no new classes demonstrated.

Chapter 7 Notes

Title: XAML vs. Code

Summary

  • XAML is a better way to write up the "view" part of MVVM.
  • XAML is used to write the tree-structured visual user interface

Concepts Not in programs

Converter Classes

Page 134

Below the Color class has a TypeConverter attribute added. Attributes in this context means that the defined attributed class is added to the decorated class. That means that you may have additional properties because of the decoration. You might say that Color now has a TypeConverter object that is instantiated with a Type - in this case the: typeof(ColorTypeConverter)

This, of course, means that Color has additional functionality! We'll learn more about this later!

   1 [TypeConverter (typeof(ColorTypeConverter))]
   2 public struct Color
   3 {
   4 
   5 }

Property-[Element|Attribute] Syntax:

Page 136

This section spells out how to translate some of the code we are used to writing into XAML. Specifically it identifies how XML elements and attributes map to objects and contents.

  • <Frame ...> ... </Frame> is a object element

  • <Frame.Content> ... </Frame.Content> is a property element

  • In <Frame VerticalOptions="Center" ...> ... </Frame>, VerticalOptions is a property attribute.

XAML Compiler

Page 145

You can force your output to compile the XAML instead of using it directly. This saves time and space, but is new and therefore suspect. Add the following line to your Assembly.cs file in the properties folder.

   1 [assembly: XamlCompilation(XamlCompilationOptions.Compile)]

Programs

ScaryColorList

Page 146.

Concepts:

  1. Shows how to do OnPlatform in XAML

  2. Shows how to nest object elements, property attributes and property elements properly.
  3. Shows code behind concepts
  4. introduces the concept of a default property (p. 151) and the ConntentPrpoertyAttribute.

Classes:

  1. OnPlatform class was used (as a variation of the Device.OnPlatform(...))

  2. ... no new classes demonstrated.

ManagingAndProgrammingMobileApplications/Xamarin/Chapter 7 (last edited 2016-09-13 00:13:55 by scot)