Intro; Table of Contents; About the Authors; About the Technical Reviewer; Acknowledgments; Foreword by David Ortinau; Introduction; Chapter 1: Fundamentals; Custom Renderers; Built-in Renderers; Implementing a Custom Renderer; Effects; Effects Versus Custom Renderers; Implementing an Effect; MessagingCenter; How MessagingCenter Works; Using MessagingCenter; DependencyService; Using the DependencyService; DependencyFetchTarget; Behaviors; Xamarin. Forms Behaviors; Attached Behaviors; Summary; Chapter 2: User Interface; Exploring the Layout Options; Using the Right Layout Controls; StackLayout;Use the solutions provided in this book to handle common challenges in Xamarin. Forms that are encountered on a daily basis. Working examples and techniques are presented that you can modify and drop directly into your own projects. You will be able to deliver working code faster than ever. Examples are made available through GitHub, maximizing the convenience and value this book provides to Xamarin. Forms developers. Solutions in the book are organized broadly into problem domains such as user interface for applications, data and security, connectivity and external services, and more. Within each domain the book presents specific solutions addressing challenges that are commonly faced. Under data and security, for example, you'll find specific solutions around storing login credentials, local data caching, and sending authorization tokens in HTTP requests. Not only do the solutions in the book solve specific problems, they also present best practices that can inform and improve the quality of the code that you write. Xamarin. Forms Solutions is chock full of practical advice and code examples that no Xamarin. Forms programmer will want to be without. The basics of Xamarin. Forms are provided for beginning developers. What You'll Learn: Know the in-depth basics of Xamarin. Forms and the inner workings Create custom renderers and dependency services Manage the appearance of user interfaces through styling and theming, layout options, rotation, and animation Build sophisticated user interfaces using a variety of controls that allow for PDF viewing, barcode interpretation, searching and finding, and other controls Secure your applications, and communicate securely with services via HTTP requests Sign and deploy your apps and optimize the binary file size. Table of Contents 4 About the Authors 9 About the Technical Reviewer 10 Acknowledgments 11 Foreword by David Ortinau 12 Introduction 14 Chapter 1: Fundamentals 16 Custom Renderers 16 Built-in Renderers 16 Implementing a Custom Renderer 18 Effects 25 Effects Versus Custom Renderers 26 Implementing an Effect 26 MessagingCenter 33 How MessagingCenter Works 34 Using MessagingCenter 34 DependencyService 36 Using the DependencyService 37 DependencyFetchTarget 40 Behaviors 40 Xamarin.Forms Behaviors 41 Attached Behaviors 44 Summary 48 Chapter 2: User Interface 49 Exploring the Layout Options 49 Using the Right Layout Controls 50 StackLayout 50 RelativeLayout 51 AbsoluteLayout 54 Grid 56 ScrollView 59 Determining the Right Alignment and Expansion 61 Alignment 61 Expansion 63 Margin and Padding 63 Specifying Thickness Values 64 Introducing the FlexLayout 64 Direction 67 Wrap 69 JustifyContent 70 AlignItems 72 AlignContent 74 AlignSelf 75 Order 76 Basis 76 Grow 77 Shrink 79 Changing Our UI Based on Data 80 Property Triggers 80 Data Triggers 81 Event Triggers 82 Multi Triggers 83 Using Triggers with Style 84 Using EnterActions and ExitActions 85 Working with Animations 86 Adding Simple Animations 87 Translation 87 Scaling 89 Rotation 90 Fading 92 Working with Anchors 93 Cancelling an Animation 95 Combining Animations 95 Working with Easing 97 Working with Custom Animations 98 Creating an Animation 98 Cancelling an Animation 99 Using Child Animations 100 Creating a Custom Animation Extension Method 101 Using Custom Fonts 102 Adding a Custom Font in iOS 102 Adding a Custom Font in Android 103 Finding the PostScript Name of the Font 104 Tying It All Together in Shared Code 106 Creating Reusable Controls 108 Introducing a Simple Use Case 109 Creating a Custom Control 110 Creating a Bindable Property 110 Using a Custom Control 115 Exploring Gestures 117 Adding a TapGestureRecognizer 117 Adding a PinchGestureRecognizer 118 Adding a PanGestureRecognizer 119 Summary 121 Chapter 3: Working with Data 122 Getting Data Onto the Screen 122 Data Binding Basics 123 Data Bindings in Xamarin.Forms 123 Different Binding Modes 126 Overriding the Default Binding Mode 127 Notifying the App of Data Changes 128 Implementing INotifyPropertyChanged Using Fody 129 Working with Collections 131 Converting Data Bound Values 133 Using ValueConverters to Tackle Complex Scenarios 134 Getting to Know the ListView 136 Understanding the Basics 138 Using the Built-In Cell Types 138 Defining Separators and Row Height 143 Adding Headers and Footers 145 Selecting Items and Handling Tap Events 148 Adding a Pull-to-Refresh 149 Using a Context Action to Act on a List Item 151 Adding a Jump List for Easy Navigation 153 Using Data Templates 157 Creating a Data Template 158 Create an Inline Data Template 158 Create a Data Template in a Resource Dictionary 159 Create a Custom Cell Type to Use in the Data Template 160 Dynamically Selecting a Data Template 161 Caching Data Using the ListView 163 Summary 164 Chapter 4: Network and Security 165 Connecting with REST APIs 165 The Old-Fashioned Way 165 HTTP Requests with Refit 167 Other Libraries 170 Connectivity 170 Caching 175 Akavache 175 Monkey Cache 181 Network Resilience 183 Retry Policy 185 Timeout 187 PolicyWrap 188 Conditional HTTP Requests 190 Sensitive Data 197 Storing Sensitive Data 197 Transferring Data Securely 198 Tying It All Together 200 Summary 201 Chapter 5: Business App Concepts 202 Showing a PDF File 202 Shared Project 203 iOS Project 204 Android Project 206 Showing the PDF File 208 Scanning Barcodes 211 Installing ZXing 212 iOS 212 Android 213 UWP 215 Implementing Barcode Scanning 215 Implementing Generating Barcodes 219 App Center Integrations 220 What Is App Center? 220 Creating Your App in App Center 221 Building, Testing, and Distributing 222 Crash Reporting 223 Analytics 225 App Versioning 228 iOS 229 Android 230 Setting the Version Number with Azure Pipelines 231 Localization 233 Localize Using Resource Files 234 Localize Using i18n Portable 249 Summary 252 Chapter 6: Advanced Topics 253 Converting a PCL to .NET Standard 254 Why Should We Upgrade? 254 Upgrading to .NET Standard 255 Reducing the Size of Our App 256 What Does Xamarin Already Do for Us? 256 Fixing Errors Caused by the Linker 258 Using an Icon Font Instead of Images 260 Replacing Images with an Icon Font 261 Additional File Size Improvements 262 Remove Unnecessary Resources 262 Splitting Your App Binary 262 Compress Images 262 Signing and Deploying Our Code 263 Automatic Provisioning on iOS 263 Introducing Fastlane 264 Connecting the Apple Account to Visual Studio 264 Enabling Automatic Provisioning 265 Signing and Publishing on iOS 266 Archive for Publishing 266 Signing and Publishing 268 Publishing to the AppStore 270 Signing and Publishing on Android 272 Archive for Publishing 272 Creating a Certificate 273 Signing and Publishing APK File 276 Publishing to Google Play 278 Contributing to Xamarin.Forms 281 The Human Side 281 How to Get Started 282 Summary 284 Index 285 Use the solutions provided in this book to handle common challenges in Xamarin.Forms that are encountered on a daily basis. Working examples and techniques are presented that you can modify and drop directly into your own projects. You will be able to deliver working code faster than ever. Examples are made available through GitHub, maximizing the convenience and value this book provides to Xamarin.Forms developers. Solutions in the book are organized broadly into problem domains such as user interface for applications, data and security, connectivity and external services, and more. Within each domain the book presents specific solutions addressing challenges that are commonly faced. Under data and security, for example, you’ll find specific solutions around storing login credentials, local data caching, and sending authorization tokens in HTTP requests. Not only do the solutions in the book solve specific problems, they also present best practices that can inform and improve the quality of the code that you write. Xamarin.Forms Solutions is chock full of practical advice and code examples that no Xamarin.Forms programmer will want to be without. The basics of Xamarin.Forms are provided for beginning developers. What You'll Learn • Know the in-depth basics of Xamarin.Forms and the inner workings • Create custom renderers and dependency services • Manage the appearance of user interfaces through styling and theming, layout options, rotation, and animation • Build sophisticated user interfaces using a variety of controls that allow for PDF viewing, barcode interpretation, searching and finding, and other controls • Secure your applications, and communicate securely with services via HTTP requests • Sign and deploy your apps and optimize the binary file size Who This Book Is For Those building mobile applications on the Xamarin platform for iOS and Android. By mixing together the solutions and a thorough explanation of the basics of Xamarin.Forms, the book spans the needs of beginning through intermediate Xamarin.Forms developers. Even experts will find a few gems to improve the quality and speed of their application development work. Use the solutions provided in this book to handle common challenges in Xamarin. Forms that are encountered on a daily basis. Working examples and techniques are presented that you can modify and drop directly into your own projects. You will be able to deliver working code faster than ever. Examples are made available through GitHub, maximizing the convenience and value this book provides to Xamarin. Forms developers. Solutions in the book are organized broadly into problem domains such as user interface for applications, data and security, connectivity and external services, and more. Within each domain the book presents specific solutions addressing challenges that are commonly faced. Under data and security, for example, you'll find specific solutions around storing login credentials, local data caching, and sending authorization tokens in HTTP requests. Not only do the solutions in the book solve specific problems, they also present best practices that can inform and improve the quality of the code that you write. Xamarin. Forms Solutions is chock full of practical advice and code examples that no Xamarin. Forms programmer will want to be without. The basics of Xamarin. Forms are provided for beginning developers. What You'll Learn Know the in-depth basics of Xamarin. Forms and the inner workings Create custom renderers and dependency services Manage the appearance of user interfaces through styling and theming, layout options, rotation, and animation Build sophisticated user interfaces using a variety of controls that allow for PDF viewing, barcode interpretation, searching and finding, and other controls Secure your applications, and communicate securely with services via HTTP requests Sign and deploy your apps and optimize the binary file size Who This Book Is For Those building mobile applications on the Xamarin platform for iOS and Android. By mixing together the solutions and a thorough explanation of the basics of Xamarin. Forms, the book spans the needs of beginning through intermediate Xamarin. Forms developers. Even experts will find a few gems to improve the quality and speed of their application development work Front Matter ....Pages i-xviii Fundamentals (Gerald Versluis, Steven Thewissen)....Pages 1-33 User Interface (Gerald Versluis, Steven Thewissen)....Pages 35-107 Working with Data (Gerald Versluis, Steven Thewissen)....Pages 109-151 Network and Security (Gerald Versluis, Steven Thewissen)....Pages 153-189 Business App Concepts (Gerald Versluis, Steven Thewissen)....Pages 191-241 Advanced Topics (Gerald Versluis, Steven Thewissen)....Pages 243-274 Back Matter ....Pages 275-281