Xamarin with Visual Studio: Launch your mobile development career by creating Android and iOS applications using .NET and C#
Learn how to build cross-platform mobile apps from a single shared codebase
- Covers fundamental and advanced aspects of multi-platform mobile development
- Revisit the fundamentals of .NET and C# to create modern native apps more quickly
- Check out tips and advice on getting started as a successful mobile developer
For any mobile developer, it’s clear that Xamarin knowledge is vital, thanks to the reintroduction of .NET MAUI. This book provides the reader with complete hands-on experience in designing cross-platform mobile applications with Xamarin, C#, and .NET.
The book discusses the importance of cross-platform mobile app development and the benefits of learning Xamarin. The book delivers a quick lesson on C# and Visual Studio to implement all of the knowledge gained in this book into your first mobile application.
In the second half of the book, you’ll learn to start from scratch using Xamarin and create mobile apps in C#. It explains how to utilise Visual Studio as the development environment, design the user interface using the XAML markup language, organise common controls into layouts, and create multi-page applications with navigation and various pages. This includes creating reusable resources, such as styles and templates, and the use of local and remote databases for data manipulation. In addition, the book offers expert advice on the requirements of a standard mobile application, such as handling network connection, battery level, and safeguarding data in the device’s secure storage.
WHAT YOU WILL LEARN
- Learn every aspect of Xamarin to create cross-platform mobile applications.
- Refresh .NET, C#, and Visual Studio skills required for mobile development.
- Build UI with XAML, views, and layouts, including navigation.
- Use reusable resources, data-oriented coding, multimedia support, and debug code.
- Explore advanced programming patterns and ways to improve performance.
WHO THIS BOOK IS FOR
This book is intended for beginners, aspiring mobile developers, .NET users, Visual Studio users, and application developers eager to design and build mobile apps compatible with numerous platforms. This book will also refresh your knowledge of .NET and C# so you can begin Xamarin development rapidly.
Cover Page Title Page Copyright Page Dedication Page About the Author About the Reviewer Acknowledgement Preface Errata Table of Contents 1. The Importance of Mobile App Development Introduction Structure Objectives The importance of mobile app development Mobile devices and applications A brief history of modern mobile devices Mobile devices for everyone Mobile devices everywhere The importance of mobile apps for companies Career opportunities with mobile app development Making money with mobile app development Summarizing how a mobile system works The importance of a cross-platform approach Limitations of cross-platform code Application size and performance Understanding native applications Demystifying application performance issues Staying up to date with new devices and platforms Getting updates from Apple Getting updates from Google Getting news from Microsoft Conclusion Points to remember 2. Xamarin and Microsoft in the Mobile App Market Introduction Structure Objectives Xamarin as the app development framework Mobile App Development with Microsoft Skills Xamarin as a company Introducing the mono project The transition to Xamarin Microsoft in the mobile app ecosystem The importance of Microsoft investments on Xamarin Improved productivity with Microsoft tools and services Understanding Xamarin and Xamarin.Forms Advantages of Xamarin.Forms Hints about .NET MAUI Installing and configuring the development tools System requirements for Xamarin System requirements on Windows System requirements on macOS Android and iOS Devices Installing and configuring Microsoft Visual Studio Selecting workloads Checking for individual components Configuring Android devices for developer mode Minimum macOS configuration Conclusion Questions Points to remember 3. Introducing .NET and Visual Studio Introduction Structure Objectives Introducing .NET Introducing the .NET framework for Windows Locating the .NET framework on disk The .NET framework architecture The Common Language Runtime (CLR) Compilers and the concept of Assembly Assemblies in .NET The Base Class Library From .NET Framework to .NET Core Advantages of .NET Core .NET 6: One .NET Building applications with Visual Studio Signing in with a Microsoft account Synchronized settings Introducing the Start window Understanding projects and solutions Creating projects with C# Creating your first C# project Working with the Visual Studio IDE Working with tool windows Solution Explorer The Error List The Properties window The Output window Editing project properties Editing application settings Basic code editing features Syntax colorization Zooming the code editor Introducing IntelliSense Changing the Code Editor options Compiling, running, and debugging code Understanding configurations Running and Debugging Code Debugging your code Preparing the sample project for debugging Breakpoints and data tips Detecting and fixing runtime errors Conclusion Points to remember Key terms 4. The C# Programming Language Introduction Structure Objectives Understanding data types Meet the Common Type System Clarifying value types and reference types .NET primitive types Declaring and consuming variables Clarifying the difference between value and reference types Common data operators Equals and Not Equals Operators Arithmetic operators Conversion operators Direct type conversion Converting types with the Convert class String conversion Logical operators Working with strings Checking for Null or Empty strings Concatenating strings Formatting strings Iterating objects Understanding loops Introducing the do loop Introducing the while loop Conditional code blocks The if conditional code block The switch conditional code block Introducing arrays Single-dimensional arrays Multi-dimensional arrays Jagged arrays Object-oriented programming (OOP) Understanding access modifiers Defining reference types with classes Storing information with fields and properties Running actions with methods Introducing constructors and static classes Defining derived types with inheritance Understanding interfaces and abstract classes Defining interfaces Implementing interfaces Introducing abstract classes Organizing types within namespaces Accessing types within namespaces with using directives Defining value types with structures Assigning structures to variables Visibility of structures and their members Defining enumerations Using enumerations Implementing error handling Implementing events Advanced C# programming Generics and Nullable Types Working with Nullable types Language INtegrated Query (LINQ) Asynchronous programming Conclusion Suggested readings 5. Building Apps with Xamarin and Xamarin.Forms Introduction Structure Objective Understanding Xamarin.Android Projects Understanding the project structure Drawing and handling the user interface Configuring the App Manifest Debugging an Android app Configuring debugging and Build options Understanding Xamarin.iOS projects Understanding the project structure Handling the user interface Debugging an iOS app Understanding provisioning profiles and developer accounts Configuring App Package options Cross-platform projects with Xamarin.Forms Understanding the project structure Introducing XAML, App.xaml, and MainPage.xaml Running and debugging apps Preparing apps for publication Preparing Android packages Preparing iOS packages Conclusion Points to remember Key terms 6. Organizing the User Interface with Layouts Introduction Structure Objectives Understanding the concept of layout Alignment and spacing options Understanding the visual tree .NET objects hierarchy Organizing the user interface Creating a Sample Project The StackLayout The FlexLayout The Grid Spacing, proportions and spans for rows and columns The AbsoluteLayout The RelativeLayout The ScrollView Controlling the ScrollView programmatically The Frame The ContentView Using a ContentView Styling the user interface with cascading style sheets Defining CSS styles as a XAML resource Consuming CSS files in XAML Creating and implementing CSS styles in C# Conclusion Points to remember Key terms 7. Understanding Common Views Introduction Structure Objectives Creating a sample project Common properties Working with text Displaying text with the label Accepting user input with entry and editor Entering passwords Applying and managing fonts Implementing custom fonts Complex text formatting with FormattedString User interaction with buttons Selecting dates and time Selecting dates with the DatePicker Selecting a time with the TimePicker Displaying HTML content Selecting Boolean and numerical values Turning options on and off with the switch User choices with the CheckBox Multiple choices with RadioButton Implementing multiple groups Value selection with the Slider Incremental value selection with the Stepper Implementing search functionalities Handling long-running tasks Displaying images Handling the aspect Managing image files Adding interactivity to Views Implementing GestureRecognizers Displaying and handling alerts Understanding visual states Conclusion Key terms Suggested readings 8. Pages and Navigation Introduction Structure Objectives Introducing available pages Individual pages: The ContentPage Master-details views: The FlyoutPage Organizing contents within tabs: The TabbedPage Scrolling pages: The CarouselPage Navigating between pages Sharing data between pages Implementing custom titles Understanding pages lifecycle Intercepting the physical back button Common app features: The Shell Understanding the structure of the Shell Adding a Flyout menu Leveraging built-in navigation: The Tab bar Implementing both the Flyout and Tab bar Implementing the Search bar Programmatically interacting with the Shell Changing the Shell styles Conclusions Key terms Suggested readings 9. Resources and Data Binding Introduction Structure Objectives Creating a sample project Understanding and Defining Resources Defining resources Defining and assigning styles Implementing style inheritance Implementing implicit styling Binding data to the user interface Getting started with data binding Property change notifications: INotifyPropertyChanged Assigning the binding context Working with data collections Displaying data: The ListView The DataTemplate as a resource Binding different types: Value converters Displaying Collections efficiently Displaying lists with the CollectionView Scrolling lists with the CarouselView Displaying item indicators with the IndicatorView Selecting items with the Picker Introducing bindable layouts Advanced data binding: The Model-View-ViewModel pattern Defining the data model Implementing the business logic: Commands and ViewModels Exposing data Defining actions with Commands Designing the user interface MVVM frameworks Pull-to-Refresh gesture: The RefreshView Local data access with SQLite databases Installing the SQLite NuGet package Getting the database path Implementing a data model Implementing a data access layer Invoking the data access layer Extending the user interface Conclusion Key terms 10. Brushes, Shapes, and Media Introduction Structure Objectives Creating a sample project Coloring objects with brushes Defining linear gradients Defining circular gradients Drawing shapes Drawing circles and ellipses Drawing rectangles Drawing lines Drawing polygons Drawing custom shapes Further studies: Path and geometries Working with multimedia Installing the Xamarin Community Toolkit Implementing the MediaElement Controlling the media file Playing local files Conclusion Key terms Suggested readings 11. Managing the Application Lifecycle Introduction Structure Objectives Creating a sample project The Application class Working with themes Defining global variables Events of the Application lifecycle Understanding and using Application events A real-world example: Storing and retrieving data A real-world scenario: Restoring data forms Responding to page events Sending messages through the app Broadcast messages with MVVM MessagingCenter tips and tricks Conclusion Key terms Suggested readings 12. Working with Web API Introduction Structure Objectives Chapter prerequisites Getting a Free Azure subscription Downloading Postman Understanding web services and Web API JSON: A standard data exchange format Creating Web API in Visual Studio Understanding the project structure Creating a data model Implementing controllers Retrieving data Creating and updating data objects Deleting data objects Testing Web API services Making API calls with Postman Publishing Web API services Consuming Web API with Xamarin.Forms Creating a data model Creating the ViewModel Calling Web API services from C# Designing the user interface Testing the application Conclusion Key terms Suggested readings 13. Working with Native API Introduction Structure Objectives Preparing a sample project Working with the device class Working with Timers Running thread-safe code Device-based content orientation Conditional XAML: OnPlatform and OnIdiom Advanced view customization: Custom renderers Defining a custom view Defining the Android renderer Defining the iOS renderer Applying custom renderers to views More information on custom renderers Managing native properties with effects Declaring effects Implementing platform-specific effects Testing the code Displaying native views Customizing views with platform-specifics Accessing device features: The DependencyService class Cross-platform access to native API: Xamarin.Essentials Checking the network connection Checking the battery status Sending emails and SMS messages Sending emails Sending SMS messages Opening contents Opening the web browser Opening default apps Storing user preferences Storing secure settings Secure settings with app version tracking More essentials API Hints about plugins Conclusion Key terms Suggested readings 14. Finding a Job Introduction Structure Objectives Preparing your resume Finding jobs, the modern way: Using LinkedIn Searching for a job A step forward: Attracting jobs Connecting with the right contacts Sharing contents from others Sharing your knowledge Writing articles and other content Joining online communities Sharing your code Final considerations about LinkedIn Preparing for job interviews Technical interviews Personal interviews Conclusion Points to remember 15. Succeeding as a Mobile App Developer Introduction Structure Objectives Developing your passion and curiosity Experiment on custom projects Experimenting with third-party components Learning to be a team player Staying up-to-date with development technologies Attending conferences and meetups Conclusion Points to remember Suggested readings Index
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.