Creating Mobile Apps with Xamarin.Forms

Total Page:16

File Type:pdf, Size:1020Kb

Creating Mobile Apps with Xamarin.Forms PREVIEW EDITION This excerpt provides early content from a book currently in development and is still in draft format. See additional notice below. PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2014 Xamarin, Inc. All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. ISBN: 978-0-7356-9725-6 Microsoft Press books are available through booksellers and distributors worldwide. Please tell us what you think of this book at http://aka.ms/tellpress. This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information in this document, including URL and other Internet website references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. This ERRNH[SUHVVHVWKHDXWKRU·s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/ Trademarks/EN- US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred. This ERRNH[SUHVVHVWKHDXWKRU·s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions and Project Editor: Devon Musgrave Cover illustration: Serena Zhang Table of contents Introduction .............................................................................................................. 7 Who should read this book .......................................................................................................................................................... 7 Assumptions ................................................................................................................................................................................. 7 Organization of this book ............................................................................................................................................................. 7 Conventions and features in this book..................................................................................................................................... 8 System requirements ...................................................................................................................................................................... 8 Downloads: Code samples ............................................................................................................................................................ 9 Updating the code samples ................................................................................................................................................... 9 Acknowledgments ..........................................................................................................................................................................10 Free ebooks from Microsoft Press ............................................................................................................................................10 We want to hear from you .........................................................................................................................................................10 Chapter 1 How does Xamarin.Forms fit in?......................................... 11 Cross-platform mobile development ......................................................................................................................................12 The mobile landscape ............................................................................................................................................................12 Problem 1: Different user-interface paradigms ...........................................................................................................12 Problem 2: Different development environments ......................................................................................................13 Problem 3: Different programming interfaces .............................................................................................................13 Problem 4: Different programming languages ............................................................................................................13 The C# and .NET solution ...........................................................................................................................................................14 A single language for all platforms ...................................................................................................................................15 Sharing code ..............................................................................................................................................................................16 Introducing Xamarin.Forms .......................................................................................................................................................18 The Xamarin.Forms option ...................................................................................................................................................18 XAML support ............................................................................................................................................................................20 Platform specificity ..................................................................................................................................................................22 2 A cross-platform panacea? ..................................................................................................................................................23 Your development environment ...............................................................................................................................................23 Machines and IDEs ..................................................................................................................................................................24 Devices and emulators...........................................................................................................................................................24 Installation ........................................................................................................................................................................................25 Creating an iOS app................................................................................................................................................................25 Creating an Android app ......................................................................................................................................................26 Creating a Windows Phone app ........................................................................................................................................26 All ready? .....................................................................................................................................................................................26 Chapter 2 Pages, layouts, and views ......................................................27 Say hello ............................................................................................................................................................................................28 Anatomy of a Xamarin.Forms solution ................................................................................................................................. 30 The iOS project .........................................................................................................................................................................32 The Android project ................................................................................................................................................................33 The Windows Phone project ...............................................................................................................................................34
Recommended publications
  • Volume 2014, No. 1 Law Office Computing Page Puritas Springs Software Law Office Computing
    Volume 2014, No. 1 Law Office Computing Page Puritas Springs Software Law Office Computing VOLUME 2014 NO. 1 $ 7 . 9 9 PURITAS SPRINGS SOFTWARE Best Home Pages We think the importance of the through which you accessed INSIDE THIS ISSUE: home page has been greatly the world wide web. Once 1-3 reduced due to the invention of tabbed browsers arrived on the tabbed browsers. Although scene it was possible to create 1,4,5 conceived a group of 4 earlier in 1988, home pages Digital Inklings 6,7 tabbed brows- with each page Child Support 8 ing didn’t go being able to Spousal Support 10 mainstream “specialize” in a Uniform DR Forms 12 until the re- specific area of lease of Micro- your interest. Family Law Documents 13 soft’s Windows Take the Probate Forms 14 Internet Ex- weather for Ohio Estate Tax 16 plorer 7 in example. Every U.S. Income Tax (1041) 18 2006. Until then, your Home good home page should have Ohio Fiduciary Tax 19 page was the sole portal a minimal weather information; (Continued on page 2) Ohio Adoption Forms 20 OH Guardianship Forms 21 OH Wrongful Death 22 Loan Amortizer 23 # More Law Office Tech Tips Advanced Techniques 24 Deed & Document Pro 25 Bankruptcy Forms 26 XX. Quick Launch. The patch the application that you’re Law Office Management 28 of little icons to the right of the working in is maximized. If OH Business Forms 30 Start button is called the Quick you’re interested, take a look Launch toolbar. Sure, you can at the sidebar on page XX of Business Dissolutions 31 put much-used shortcuts on this issue.
    [Show full text]
  • XAMARIN.FORMS for BEGINNERS ABOUT ME Tom Soderling Sr
    XAMARIN.FORMS FOR BEGINNERS ABOUT ME Tom Soderling Sr. Mobile Apps Developer @ Polaris Industries; Ride Command Xamarin.Forms enthusiast DevOps hobbyist & machine learning beginner 4 year XCMD Blog: https://tomsoderling.github.io GitHub: https://github.com/TomSoderling Twitter: @tomsoderling How Deep Pickster Spaniel Is It? THE PLAN • Introduction: Why, What, and When • Overview of Xamarin.Forms Building Blocks • Building a Xamarin.Forms UI in XAML • Data Binding • View Customization • Next Steps & Resources • Please ask any questions that come up! THE PLAN • Introduction: Why, What, and When • Overview of Xamarin.Forms Building Blocks • Building a Xamarin.Forms UI in XAML • Data Binding • View Customization • Next Steps & Resources INTRODUCTION : WHY • WET: the soggy state of mobile app development • Write Everything Twice INTRODUCTION : WHY • WET: the soggy state of mobile app development • Write Everything Twice INTRODUCTION : WHAT • What is Xamarin.Forms? • Cross-platform UI framework • Platforms: • Mobile: iOS 8 and up, Android 4.0.3 (API 15) • Desktop: Windows 10 UWP, MacOS, WFP • Samsung Smart Devices: Tizen INTRODUCTION : WHAT • Brief History: • May 2011, Xamarin founded • MonoTouch and Mono for Android using MonoDevelop IDE • February 2013, release of Xamarin 2.0 • Xamarin Studio IDE & integration with Visual Studio • Renamed to Xamarin.Android and Xamarin.iOS • May 2014, Xamarin.Forms released as part of Xamarin 3 • February 24 2016, Xamarin acquired by Microsoft • Owned, actively developed on, and supported by Microsoft • Free
    [Show full text]
  • Web API and Microsoft Azure
    [ 1 ] www.it-ebooks.info Building Web Services with Microsoft Azure Quickly develop scalable, REST-based applications or services and learn how to manage them using Microsoft Azure Alex Belotserkovskiy Stephen Kaufman Nikhil Sachdeva professional expertise distilled PUBLISHING BIRMINGHAM - MUMBAI www.it-ebooks.info Building Web Services with Microsoft Azure Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: May 2015 Production reference: 1220515 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78439-837-8 www.packtpub.com www.it-ebooks.info Credits Authors Copy Editors Alex Belotserkovskiy Pranjali
    [Show full text]
  • End to End Azure and Xamarin.Forms
    End-to-End Native Mobile Apps with C# and Xamarin James Montemagno Developer Evangelist, Xamarin [email protected] motzcod.es @JamesMontemagno DESIGN – DEVELOP - INTEGRATE TEST MONITOR LEARN iOS C# UI Android C# UI Windows C# UI Shared C# Mobile Shared C# codebase • 100% native API access • High performance Microsoft.Phone Microsoft.Networking Windows.Storage Windows.Foundation Microsoft.Devices System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel MapKit UIKit iBeacon CoreGraphics CoreMotion System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel Text-to-speech ActionBar Printing Framework Renderscript NFC System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel .NET IL + JIT Compile C# and Link .APK Runs Natively Bindings Xamarin.iOS does full Ahead Of Time Xamarin.Android takes advantage of (AOT) compilation to produce an ARM Just In Time (JIT) compilation on the binary for Apple’s App Store. Android device. • • • • • ✓Always Up-to-Date • • • • • • iOS C# UI Android C# UI Windows C# UI Shared UI Code Shared C# Backend Shared C# Backend Traditional Xamarin With Xamarin.Forms: Approach More code-sharing, all native ✓ 40+ Pages, layouts, and controls (Build from code behind or XAML) Shared UI Code ✓ Two-way data binding ✓ Navigation Shared C# Backend ✓ Animation API ✓ Dependency Service ✓ Messaging Center Pages Content MasterDetail
    [Show full text]
  • Microsoft Mobility and Security for Enterprise Architects
    Microsoft Mobility What IT architects need to know about mobility with Microsoft cloud services and Security for and platforms Enterprise Architects This topic is 1 of 4 in a series 1 2 3 4 Enable productivity and collaboration from anywhere while protecting data and applications Microsoft provides broad support for mobile productivity with support for applications and rich features for controlling access to your organization s assets. Microsoft mobile apps for business Developing your own mobile apps Microsoft produces a number of business class mobile apps for Use the Mobile Apps feature of Azure App Service to build engaging productivity. See page two for featured applications. iOS, Android, and Windows apps or cross-platform Xamarin or Cordova (Phonegap) apps for your customers and business. With an Office 365 for business subscription, you get mobile apps that help you get more done from your favorite device while keeping your Broadcast push with customer data secured. Use Intune Mobile Application Management to apply segmentation additional security when using these mobile applications. Enterprise single sign-on with Active Directory Autoscale to support millions of devices Skype for Business, Yammer, OneNote, and more apps for business Apps can work offline and sync are also available. Get the full list of apps and learn how to set them Social integration with Facebook, up on your devices. Twitter, Google Dynamics CRM also includes apps for phones and tablets. Cloud App Security for SaaS apps Mobile access to on-prem applications Microsoft Cloud App Security is a comprehensive service that provides Microsoft Azure Active Directory Application Proxy lets you publish deeper visibility, comprehensive controls, and improved protection for applications, such as web-based apps inside your private network and your cloud applications.
    [Show full text]
  • Surface Pro Et Surface Pro 2 Guide De L'utilisateur
    Surface Pro et Surface Pro 2 Guide de l’utilisateur Avec Windows 8.1 Professionnel Date de publication : Octobre 2013 Version 2.0 © 2013 Microsoft. Tous droits réservés. BlueTrack Technology, ClearType, Excel, Hotmail, Internet Explorer, Microsoft, OneNote, Outlook, PowerPoint, SkyDrive, Windows, Xbox et Xbox Live sont des marques déposées de Microsoft Corporation. Surface, Skype et Wedge sont des marques commerciales de Microsoft Corporation. Bluetooth est une marque déposée de Bluetooth SIG, Inc. Dolby et le symbole double-D sont des marques déposées de Dolby Laboratories. Ce document est fourni « en l’état ». Les informations contenues dans ce document, y compris les URL et d’autres références à des sites Web Internet, sont susceptibles d’être modifiées sans préavis. © 2013 Microsoft Page ii Sommaire DECOUVREZ SURFACE PRO ............................................................................................................................................1 À PROPOS DE CE GUIDE ........................................................................................................................................................................................ 1 CARACTERISTIQUES DE SURFACE PRO ................................................................................................................................................................ 2 CONFIGURATION DE VOTRE SURFACE PRO ................................................................................................................5 BRANCHEMENT ET ALLUMAGE ............................................................................................................................................................................
    [Show full text]
  • Security Policy for FIPS 140-2 Validation
    Cryptographic Primitives Library Security Policy for FIPS 140-2 Validation Cryptographic Primitives Library (bcryptprimitives.dll and ncryptsslp.dll) in Microsoft Windows 8.1 Enterprise Windows Server 2012 R2 Windows Storage Server 2012 R2 Surface Pro 3 Surface Pro 2 Surface Pro Surface 2 Surface Windows RT 8.1 Windows Phone 8.1 Windows Embedded 8.1 Industry Enterprise StorSimple 8000 Series Azure StorSimple Virtual Array Windows Server 2012 R2 DOCUMENT INFORMATION Version Number 2.1 Updated On April 20, 2017 30 March 2017 © 2017 Microsoft. All Rights Reserved Page 1 of 45 This Security Policy is non-proprietary and may be reproduced only in its original entirety (without revision). Cryptographic Primitives Library The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. This work is licensed under the Creative Commons Attribution-NoDerivs- NonCommercial License (which allows redistribution of the work). To view a copy of this license, visit http://creativecommons.org/licenses/by-nd-nc/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document.
    [Show full text]
  • Surface Pro 3 Fact Sheet May 2014
    Surface Pro 3 Fact sheet May 2014 Meet Surface Pro 3, the tablet that can replace your laptop. Wrapped in magnesium and loaded with a 12-inch ClearType Full HD display, 4th-generation Intel® Core™ processor and up to 8 GB of RAM in a sleek frame — just 0.36 inches thin and 1.76 pounds — with up to nine hours of Web-browsing battery life, Surface Pro 3 has all the power, performance and mobility of a laptop in an incredibly lightweight, versatile form. The thinnest and lightest member of the Surface Pro family, Surface Pro 3 features a large and beautiful 2160x1440 2K color-calibrated screen and 3:2 aspect ratio with multitouch input, so you can swipe, pinch and drag whenever you need. The improved optional Surface Pro Type Cover and more adjustable, continuous kickstand will transform your device experience from tablet to laptop in a snap. Surface Pro Type Cover features a double-fold hinge enabling you to magnetically lock it to the display’s lower bezel, keeping everything steady so you can work just as comfortably on your lap as you do at your desk. With a full-size USB 3.0 port, microSD card reader and Mini DisplayPort, you can quickly transfer files and easily connect peripherals like external displays. And with the optional Surface Ethernet Adapter, you can instantly connect your Surface to a wired Ethernet network with transfer rates of up to 1 Gbps1. The custom Surface Pen, crafted with a solid, polished aluminum finish, was designed to look and feel like an actual fountain pen to give you a natural writing experience.
    [Show full text]
  • 70-347.Microsoft
    70-347.microsoft Number : 70-347 Passing Score : 800 Time Limit : 120 min https://www.gratisexam.com/ Sections 1. Manage clients and end-user devices 2. Provision SharePoint Online site collections 3. Configure Exchange Online and Lync Online for end users 4. Plan for Exchange Online and Lync Online https://www.gratisexam.com/ Exam A QUESTION 1 DRAG DROP You are the Office 365 administrator for a company. Employees are allowed to purchase a desktop computer of their choosing. The company’s owner has one desktop computer, two laptop computers, one Surface RT device, and 2 Surface Pro 2 devices. You plan to deploy Office ProPlus. You provide each user with an Office 365 ProPlus license. You need to deploy Office 365 ProPlus to the unlicensed devices using the fewest number of licenses possible. https://www.gratisexam.com/ What should you do? To answer, move the appropriate license to the correct device. Each license may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. Select and Place: https://www.gratisexam.com/ Correct Answer: https://www.gratisexam.com/ Section: Manage clients and end-user devices Explanation Explanation/Reference: Explanation: Each Office 365 ProPlus license allows a user to install Office on up to five computers. If the user decides to install Office 365 ProPlus on a sixth computer, she will need to deactivate one of the first five. References: https://technet.microsoft.com/en-us/library/gg982959.aspx QUESTION 2 HOTSPOT https://www.gratisexam.com/ Contoso, Ltd., has an Office 365 tenant.
    [Show full text]
  • Surface Pro X Fact Sheet October 2020
    Surface Pro X Fact Sheet October 2020 Meet the future of always-connected productivity. Wherever life leads you, be ready for anything with Surface Pro X. With blazing-fast Gigabit LTE connectivity,1 our thinnest Surface Pro features two USB-C® ports and a stunning, virtually edge-to-edge 13” touchscreen, plus choice of a new platinum finish and keyboard colors.2 What’s new? • Surface Pro X introduces the Microsoft SQ®2, the second generation of our custom chip on our premium configurations, building on the innovation of the Microsoft SQ® 1, delivering even more multi-tasking power for true connected productivity. • Surface Pro X is now available in a new Platinum finish in addition to Matte Black, and Surface Pro X Keyboards are now available in three new colors2: Ice Blue, Poppy Red, and Platinum, in addition to Black. • In addition to refreshing our top-end SKUs, additional software improvements will benefit all customers of Surface Pro X: o Increased battery life that now delivers up to 15 hours of typical usage.3 o Increasing number of key app partners are embracing Windows on ARM and taking advantage of the power and performance benefits of Microsoft SQ® 1 and Microsoft SQ® 2 and bringing new experiences for all Surface Pro X customers – current and new, including new Microsoft 365 applications4 optimized for Windows on ARM such as Microsoft Edge and Microsoft Teams which provides improved performance and reliability. o For developers, Visual Studio Code4 has updated and optimized for Windows on ARM. The new VS Code, paired with WSL2 and the Windows Terminal make Surface Pro X the ideal modern dev box.
    [Show full text]
  • The New Surface Pro
    The new Surface Pro The most versatile laptop Discover the new Surface Pro A device with the versatility to let you work on your own terms. Uncompromising mobility The new Surface Pro gives you everything you need in terms Now supported by LTE connectivity2, up to 50% more battery life3 of performance, mobility, security and reliability. A best-in- than Surface Pro 4, and an ultra-light design, the new Surface class laptop with the creative freedom of a studio, and the Pro redefines mobile working. Work from virtually anywhere. convenience of a tablet. All in one. Exceptional power and performance The new Surface Pro gives you the power to run all the applications you rely on. Experience up to 20% more performance What it means for your business than Surface Pro 4 thanks to the latest, powerful Intel® Core™ processor and bring your ideas to life with the stunningly Modernize your business responsive PixelSense™ Display. With a core, connected device that will enable digital-first workflows, streamline tasks, and help you project a modern The best of Microsoft at your fingertips face to your customers. Surface is easy to deploy and manage, Choose the laptop with all of your familiar Office 3654 applications and comes standard with enterprise-grade security. and Windows 10 security you and your customers can depend on. Enjoy fast, secured, password-free sign-in with Windows Hello. Empower your employees Surface Pen4 and Surface Dial4 help you make the most of the full, Seize the power of the group with superior collaboration interactive Windows experience.
    [Show full text]
  • 2-In-1 Accessory Kit for Surface and Surface Pro
    2-in-1 Accessory Kit for Surface and Surface Pro Product ID: MSTS3MDPUGBK Get more from your Microsoft Surface™ Pro 4 or Surface Book (backward compatible with Surface Pro 3, Surface 3 and Surface Pro 2) by adding HDMI® and VGA video compatibility as well as wired network connectivity. Connect your Surface to virtually any display You can maximize the versatility of your Microsoft Surface by ensuring that you can connect to virtually any monitor, projector or television. This accessory kit ensures that you're ready to connect to any HDMI or VGA display using the Mini DisplayPort output on your Surface Pro 4, Surface Pro 3 or Surface 3 making it the perfect solution when you're traveling between boardrooms, home and remote offices, trade-shows, hotels and conference centers. Hard-wire your network connection Get the speed and reliability of a hardwired Ethernet connection with your Surface Pro 4. This Surface accessory kit includes a reliable USB 3.0 to Gigabit Ethernet adapter, which adds wired network support that's ideal for BYOD hot-desking, or use as an on-the-go dock solution to enhance your workstation. www.startech.com 1 800 265 1844 The adapter also includes an extra USB 3.0 port built-in, so you can add a USB peripheral device, such as a flash drive for added storage, or a mouse for increased control. Maximize portability Your Microsoft Surface is one of the most versatile and portable computers in the world. Don't be tied down by accessories that require an external power adapter, or a bulky housing.
    [Show full text]