Creating Mobile Apps with Xamarin.Forms Preview Edition 2

Creating Mobile Apps with Xamarin.Forms Preview Edition 2

by Charles Petzold

NOOK Book(eBook)

FREE
Available on Compatible NOOK Devices and the free NOOK Apps.
Want a NOOK ? Explore Now

Overview

Creating Mobile Apps with Xamarin.Forms Preview Edition 2 by Charles Petzold

This second Preview Edition ebook, now with 16 chapters, is about writing applications for Xamarin.Forms, the new mobile development platform for iOS, Android, and Windows phones unveiled by Xamarin in May 2014. Xamarin.Forms lets you write shared user-interface code in C# and XAML that maps to native controls on these three platforms.

Product Details

ISBN-13: 9780735697379
Publisher: Pearson Education
Publication date: 04/11/2015
Series: Developer Reference
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 400
Sales rank: 129,912
File size: 48 MB
Note: This product may take a few minutes to download.

About the Author

Charles Petzold has been writing about programming for Windows-based operating systems for 25 years. A Microsoft MVP for Client Application Development and a Windows Pioneer Award winner, Petzold is author of the classic Programming Windows, currently in its sixth edition, and one of the best-known programming books of all time; the widely acclaimed Code: The Hidden Language of Computer Hardware and Software; and more than a dozen other books.

Table of Contents

Introduction     vi
Who should read this book     vi
Conventions and features in this book     vi
The 1st and 2nd Preview Editions     vii
System requirements     vii
Downloads: Code samples     viii
Updating the code samples      viii
Big changes coming for Windows Phone      ix
Acknowledgments     ix
Free ebooks from Microsoft Press     x
We want to hear from you     x
Chapter 1 How does Xamarin.Forms fit in?      1
Cross-platform mobile development     2
The mobile landscape     2
Problem 1: Different user-interface paradigms     2
Problem 2: Different development environments     3
Problem 3: Different programming interfaces     3
Problem 4: Different programming languages     3
The C# and .NET solution     4
A single language for all platforms     5
Sharing code     6
Introducing Xamarin.Forms     8
The Xamarin.Forms option     8
XAML support     10
Platform specificity     12
A cross-platform panacea?      12
Your development environment     13
Machines and IDEs     13
Devices and emulators     14
Installation     14
Creating an iOS app     15
Creating an Android app     15
Creating a Windows Phone app     16
All ready?      16
Chapter 2 Anatomy of an app     17
Say hello     17
Inside the files     20
The iOS Project     23
The Android project     23
The Windows Phone project     24
Nothing special!      25
PCL or SAP?      25
Labels for text     27
1. Include padding on the page     31
2. Include padding just for iOS (Shared Asset Project only)      32
3. Include padding just for iOS (PCL or SAP)      33
4. Center the label within the page     35
5. Center the text within the label     37
Chapter 3 Deeper into text     38
Wrapping paragraphs     38
Text and background colors     40
The Color structure     42
Font sizes and attributes     46
Formatted text     47
Chapter 4 Scrolling the stack     54
Stacks of views     54
Scrolling content     58
The Expands option     64
Frame and BoxView     68
A ScrollView in a StackLayout?      76
Chapter 5 Dealing with sizes     81
Pixels, points, dps, DIPs, and DIUs     81
Metrical sizes     88
Estimated font sizes     89
Fitting text to available size     92
A fit-to-size clock     96
Empirically fitting text      98
Chapter 6 Button clicks     103
Processing the click     103
Sharing button clicks     106
Anonymous event handlers     109
Distinguishing views with IDs     111
Saving transient data     114
Chapter 7 XAML vs. code     121
Properties and attributes     122
Property-element syntax     126
Adding a XAML page to your project     130
Platform specificity in the XAML file     135
The content property attribute     139
Formatted text     141
Chapter 8 Code and XAML in harmony     145
Passing arguments     145
Constructors with arguments     145
Can I call methods from XAML?      148
The x:Name attribute     150
Custom XAML-based views     156
Events and handlers     160
Tap gestures     163
Chapter 9 Platform-specific API calls     170
Preprocessing in the Shared Asset Project     170
Parallel classes and the Shared Asset Project     173
DependencyService and the Portable Class Library     175
Platform-specific sound rendering     179
Chapter 10 XAML markup extensions     186
The code infrastructure     186
Accessing static members     188
Resource dictionaries     194
StaticResource for most purposes     195
A tree of dictionaries     201
DynamicResource for special purposes     205
Lesser-used markup extensions     208
A custom markup extension     209
Chapter 11 The bindable infrastructure     214
The Xamarin.Forms class hierarchy     215
A peek into BindableObject and BindableProperty     221
Defining bindable properties     228
The generic Create method     233
The read-only bindable property     234
Chapter 12 Styles     240
The basic Style     240
Styles in code     246
Style inheritance     247
Implicit styles     252
Dynamic styles     257
Device styles     264
Chapter 13 Bitmaps     269
Platform-independent bitmaps     270
Fit and fill     273
Embedded resources     275
More on sizing     281
Browsing and waiting     292
Streaming bitmaps     296
Accessing the streams     297
Generating bitmaps at run time     299
Platform-specific bitmaps     303
Bitmap resolutions     305
Toolbars and their icons     312
Button images     319
Chapter 14 Absolute layout     322
AbsoluteLayout in code     323
Attached bindable properties     328
Proportional sizing and positioning     332
Working with proportional coordinates     334
AbsoluteLayout and XAML     339
Overlays     343
Some fun     346
Chapter 15 The interactive interface     355
View overview     355
Slider and Stepper     356
Slider basics     356
Common pitfalls     359
Slider color selection     361
The Stepper difference     365
Switch and CheckBox     368
Switch basics     368
A traditional CheckBox     370
Typing text     375
Keyboard and focus     376
Choosing the keyboard     377
Entry properties and events     379
The Editor difference     385
The SearchBar     389
Date and time selection     394
The DatePicker     395
The TimePicker (or is it a TimeSpanPicker?)      398
Chapter 16 Data binding     402
Binding basics     402
Code and XAML     404
Source and BindingContext     407
The binding mode     414
String formatting     419
Why is it called “Path”?      422
Binding value converters     425
Bindings and custom views     433

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews