Getting Started - James Montemagno https://staging.montemagno.com/tag/getting-started/ https://staging.montemagno.com/content/images/2017/08/MonogramIcon_Orange_NoBuffer.png Getting Started - James Montemagno https://staging.montemagno.com/tag/getting-started/ Hugo -- gohugo.io Tue, 13 Oct 2026 23:21:57 GMT 60 5 Must Install NuGet Packages for New Xamarin Projects https://staging.montemagno.com/essentials-nugets-for-new-xamarin-projects/ 5fc80a2879e5440039355a25 Wed, 09 Dec 2020 16:52:18 GMT

Starting your first project can be a bit overwhelming. I mean heck, I wrote nearly 3,000 words breaking down every bit of what to select and what each option means. Oh, and I also have a full video series walking you through it step by step on my YouTube channel. Before I start writing code in my projects I take some time to configure my projects and then install essential NuGet packages that help me be super productive from the start.

Yes, it is true that Xamarin.Forms and Xamarin.Essentials are included "in the box" with your new project, but there is a world of amazing libraries out there from amazing community members. I want to introduce you to my favorite packages that are key in ever app that I have developed. So, let's get started.

MVVM Helpers 🎉

I may be a bit bias with these first 2 NuGet packages because I wrote them, but I think they are super essentials. First is MVVM Helpers (Refractored.MvvmHelpers), a super small library that works in any app that contains nifty classes and utilities that help creating your app from the start. It includes things such as:

  • ObservableObject: A Simple implementation of INotifyPropertyChagned
  • BaseViewModel: The only base view model you will ever need. It implements INotifyPropertyChanged and a bunch of default properties such as Title, SubTitle, Icon, IsBusy, IsNotBusy, CanLoadMore.
  • ObservableRangeCollection: Best way to group items into a Key/Value pair ObservableCollection for managing groups of data.
  • AsyncCommand: An async version of ICommand!

So, now you can just start your project and write code like this:

public class MonkeyViewModel : BaseViewModel
{
	public MonkeyViewModel()
    {
    	Title = "Monkeys";
    }

    public ObservableRangeCollection<Monkey> Monkeys { get; } = new ();

    AsyncCommand doStuffCommand;
    public AsyncCommand DoStuffCommand => doStuffCommand ??= new AsyncCommand(AsyncMethod);

    string name;
    public string Name
    {
    	get => name;
        set => SetProperty(ref name, value);
    }

    public Task AsyncMethod()
    {
    	return Task.CompletedTask
    }
}

Monkey Cache 🐵

This nice little caching library enables you to easily store data objects for set amount of times. For example you may want to cache web results for a few minutes. It integrates directly with the file system, SQLite, or LiteDB so you can write code like this:

public async Task<T> GetAsync<T>(string url, int minutes = 3)
{
    var json = string.Empty;

    if (!Barrel.Current.IsExpired(url))
    {
    	json = Barrel.Current.Get<string>(url);
    }
    else
    {
        json = await client.GetStringAsync(url);
        Barrel.Current.Add(url, json, TimeSpan.FromMinutes(minutes));
    }

    return JsonConvert.DeserializeObject<T>(json);
}

Wow, data caching in 3 lines of code! :)

PancakeView 🥞

My apps can not live without the PancakeView NuGet from Steven Thewissen. It gives your apps a breadth of new life with beautiful gradients, cards, custom rounded corners, and so much more. I mean look at this beautiful thing:

PancakeView sample scrolling through gradient backgrounds, rounded and dashed borders, border gradients, shadows, and shapes

Sharpnado 🦈🌪

Alright, technically Sharpnado is a bunch of smaller libraries, but you get to pick and choose because there is so much awesome from Jean-Marie Alfonsi.

First is Sharpnado.Tabs... fully customizable Tabs that you can put anywhere!

Sharpnado Tabs samples on Android, UWP, and iOS with custom segmented tabs and a bottom tab bar with badges

Then there is Sharpnado.Shadows, because you know you need to add lovely shadows to all of your views.

Sharpnado Shadows samples on Android, UWP, and iOS with colored shadows, neumorphic buttons, and a 3D button

That is just the start as there is a plethora more available including the TaskLoaderView, HorizontalListView, and MaterialFrame. You need these libraries!

Xamarin Community Toolkit 🧰

I am really jazzed about this initiative because it is an official package from the Xamarin team, but a deep collaboration with the community. This toolkit is a collection of controls, Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms. The NuGet is still in pre-release phase for testing, but is packed full of amazing functionality including:

  • Toast
  • Snackbar
  • AvatarView
  • MVVM Helpers (awesome stuff from my library)
  • C# Markup Extensions
  • Tons more!

Xamarin Community Toolkit sample app on Android browsing Behaviors, AvatarView, SideMenuView, and other views

Even More NuGets

These are just a few of my recommended NuGet packages that you should totally check out. There are a lot more awesome community libraries out there that you should checkout and I have a curated list on my GitHub!

]]>
Build Your First for iOS & Android App with Xamarin and Visual Studio New for Xamarin. If you are a more visual learner, I have a full video that you can watch: Let's set some groundwork first by answering some frequent questions. ]]> https://staging.montemagno.com/build-your-first-for-ios-android-app-with-xamarin-and-visual-studio/ 5fc52f3b79e5440039355a08 Mon, 30 Nov 2020 18:18:12 GMT

Let's start our journey together to build beautiful native cross-platform apps with .NET, Xamarin, and Visual Studio! In this blog I am going to guide you through the entire process and describe everything that is in File -> New for Xamarin. If you are a more visual learner, I have a full video that you can watch:

Let's set some groundwork first by answering some frequent questions.

What is .NET? .NET is a cross-platform, high-performant, and open-source runtime that is used with multiple languages, editors, and libraries that enables apps to be built for web, mobile, desktop, games, and more. It is the foundation that enables code to be run on different platforms such as iOS, Android, and Windows. If you are a web developer this is like the V8 runtime that executes JavaScript or if you are a Java developer, the JVM that executes Java.

What is Xamarin? .NET has a series of frameworks that are built for it that enable unique scenarios for developer for specific platforms. For example, ASP.NET Core and Blazor are frameworks built for .NET for web development. WPF and UWP are frameworks built for .NET for desktop development. Xamarin is a framework and tooling that enables apps to be built for iOS, Android, and macOS. It also contains several libraries that enable cross-platform development across iOS, Android, macOS, and Windows including Xamarin.Forms for cross-platform user interface and Xamarin.Essentials for accessing native platform features cross-platform.

What programming languages can I use? .NET supports several languages including C#, F#, and Visual Basic. You can use any of these programming languages to build apps with Xamarin, however I am a C# developer, and it is the primary language for app development. However, there are some fantastic frameworks for F# such as Fabulous for functional development.

XAML is another "language" that will be used to build user interface with Xamarin. XAML has been used for a long time to build Windows applications with WPF and UWP and has some great features including easy to read markup, Hot Reload technology, and advanced data binding to make UI development a breeze.

What tools can I use? .NET enables developers to use a wide range of tools including command line, code editors such as Visual Studio Code, and full IDEs (Integrated Development Environment) with Visual Studio 2019 and Visual Studio 2019 for Mac. To develop mobile apps with Xamarin we will need to use either Visual Studio 2019 or Visual Studio 2019 for Mac as they have the full features to build apps.

So, let's get started building our first mobile apps with Xamarin!

Installing Visual Studio for Mobile Development

The first step in your cross-platform journey is to install Visual Studio 2019 for Windows or Visual Studio 2019 for Mac.

When installing Visual Studio 2019 on Windows all you need to do is select the Mobile development with .NET workload: Visaul Studio 2019 Installer with Xamarin checked

On Visual Studio 2019 for Mac you can select to install Android and iOS. Visual Studio 2019 for Mac Installer with Android and iOS checked

If you are doing iOS development you will also need to install Xcode on your macOS machine.

After this you are all set and ready for mobile development!

When you create and run an Android project you may get asked to install additional Android SDKs and create Android emulators.

Creating your project

Now that we have Visual Studio 2019 and Xamarin installed let's get to work! When you launch Visual Studio 2019 you will have an option to create a new project. On Windows you can search for Xamarin.Forms or use the project types filter and select Mobile. We will want to select Mobile App (Xamarin.Forms).

New project dialog with Mobile App selected

When you select this new project, you will see a new dialog asking what type of template for the app that you would like to use:

new project template selection for flyout, tabbed, and blank

We have a few options to select based on the type of application that we want to build.

Flyout, Tabbed, & Blank

Flyout & Tabbed app templates are based on the latest Xamarin.Forms technology called Shell. It enables quicker scaffolding of apps and offers unique features such as URL based navigation. These templates are similar with a main difference if you want a flyout menu or bottom tabs for the base of your app.

Blank app is just that and offers a quite simple template with a single page and nothing else.

Let's go with Flyout! I want us to start here as most tutorials don't go through Shell and to me it is the future of Xamarin app development. This template has a lot in is so in future posts we will go through each section, but for today we will just create the project and go through what a Shell is.

If you are on Visual Studio 2019 for Mac you will want to select Multiplatform > App > Flyout Forms App

What's in the project?

Now that the app project has been created you will see several projects inside of a single solution.

Solution with 3 projects including shared code, iOS, and android

Let's walk through what is here in our new solution:

The first project contains several folders, code files, and user interface files. This project is a .NET Standard project that enables us to have a single project that can be shared across different operating systems. This project is where we will write most of our code.

iOS & Android projects are the "head" or "parent" project that is used to house platform specific code, settings, assets, and more. This is where you will want to configure different settings such as display name, app icon, version numbers, and any code that is needed for iOS or Android specific things that aren't available cross-platform. At some point you will need to go into these project and tweak things around, but for now we will stay in the cross-platform project.

Xamarin.Forms Cross-Platform UI

Inside of our cross-platform .NET Standard project we will find a bit of code for our app. This template shows off a sample app that has a list of items and an about page. Items are organized into folders:

  • Models: These are classes that represent data in your apps such as Person, Car, Dog, Cat, etc. In this app we have a single model called Item.
  • Services: Inside of this folder is where you would put code that access non-UI related things such as web service calls, databases, etc. In the project in a simple MockDataStore that is used to store items in memory.
  • Views: This is where our XAML user interface files will live!
  • ViewModels: In this folder you will find files that map nearly 1:1 to the Views folder. This is because each View has a ViewModel that is bound that Xamarin.Forms can bridge the two together so the View can display information or call methods in each ViewModel.

Let's look at the AboutPage.xaml which is the first page we will see when we launch the app. Here we see a few things, first is the top-level element ContentPage:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyAwesomeApp.Views.AboutPage"
             xmlns:vm="clr-namespace:MyAwesomeApp.ViewModels"
             Title="{Binding Title}">

Here are a few xmlns tags that represent where specific code lives. The default and x are included in every file and are for base functionality. The xmlns:vm tag allows us to access our own code from XAML, which we will see in a bit. The x:Class is a reference to the namespace and name of the page, this matches the code behind. Finally, there is a Title property that is data bound to a property called Title in our ViewModel.

We can set additional properties such as the BindingContext and Resources with XAML content. Here we are going to use that xmlns:vm tag to set the BindingContext to a new instance of the AboutViewModel:

<ContentPage.BindingContext>
    <vm:AboutViewModel />
</ContentPage.BindingContext>

Next up is a Color resource that can be used on the page. Resources allow us to remove duplicated code and create re-usable key/value pairs. This is similar in a way to CSS in web development.

<ContentPage.Resources>
    <ResourceDictionary>
        <Color x:Key="Accent">#96d1ff</Color>
    </ResourceDictionary>
</ContentPage.Resources>

We can add more things to the Resources including strings, styles, and more.

Finally, each Page can have one root element control. This is normally a Layout such as StackLayout, ScrollView, or a Grid like we have here. The grid is an awesome control that has rows and columns. We won't go much into detail of layouts, but this one displays an image, some text, and a button that can be clicked to open a web browser.

<Button Margin="0,10,0,0"
        Text="Learn more"
        Command="{Binding OpenWebCommand}"
        BackgroundColor="{StaticResource Primary}"
        TextColor="White" />

Note the {StaticResource Primary}, which is a reference to a resource we defined Accent earlier, but Primary is located in our App.xaml, which are resources avaialble across the entire app.

To find more layouts and controls you can open the Toolbox to see what is available:

Xamarin.Forms toolbox in Visual Studio

Finally, if you select a control or layout the Property pane will show you all the different properties that are available on that control.

Property Pane in Visual Studio showing properties of a button

One thing that is very important is that each of these XAML pages has code behind that is important for the XAML view and has specific methods for the constructor and event such as when the pages is shown or disappears. You can use the little arrow drop down to see the .xaml.cs code behind file.

AboutPage with drop down highlighted in project pane

If you open it up, you will see that it is very simple as for this view there isn't any special events that are needed right now.

public partial class AboutPage : ContentPage
{
    public AboutPage()
    {
        InitializeComponent();
    }
}

User Interaction and ViewModels

Now, let's talk about the ViewModel for this page that was created in the XAML. Open up the ViewModels -> AboutViewModel.cs file by double clicking on it.

public class AboutViewModel : BaseViewModel
{
    public AboutViewModel()
    {
        Title = "About";
        OpenWebCommand = new Command(async () => await Browser.OpenAsync("https://aka.ms/xamarin-quickstart"));
    }

    public ICommand OpenWebCommand { get; }
}

This is an amazingly simple ViewModel, but is a notable example of how data binding works. Here the ViewModel sets the Title to About and then creates a new Command that is calling Browser.OpenAsync to open a web browser on the page.

That Command is something special. Unlike Title which is a simple string that will be displayed, the Command is a special class that we can use to tell our user interface to do something when the user interacts with it. For example on our Button we saw the following code:

Command="{Binding OpenWebCommand}"

This code is telling Xamarin.Forms that there is a public Command in our ViewModel that has code to execute when the user clicks on the button. In this case we want to open the brower, which is one of the many native features available from Xamarin.Essentials. Calling Browser.OpenAsync will launch the browser specific for iOS and Android with a single line of code.

Quick Changes with XAML Hot Reload

Now, it is time to launch our application. I like to start on Android because emulators are available locally on both Windows and macOS. In the menu of Visual Studio you will see that Android is the default project and will the debug button is available and will show your Android Emulators available. When you click the debug button if you don't have any emulators you will be asked to created one.

Android Debug menu in Visaul Studio

When the app launches it will enter Debug mode which allows us to set break points on our code to see the values, but also enables XAML Hot Reload where we can make changes to the UI without having to stop debugging.

App launched with hot reload enabled

Let's open the AboutPage.xaml and change the Accent color to a different color. Here I will update it to Orange and I will hit save to see thechanges.

Android and XAML Hot Reload changing a background color

At this point we can add new controls, update the user interface, and continue to work on our app on Android.

Deploy to iOS with Hot Restart

Let's get iOS deployed! Right click on the iOS project and select Set as Startup Project:

Setting iOS as the startup project in the project properties

On iOS things are a bit different for developers. If you are on macOS and install Xcode you will have iOS Simulators available. If this is you, you can select a simulator and then debug your app. On Windows, there are no iOS simulators :( so there are two ways to get your

  • iOS Remoted Simulator: If you have a macOS machine you can install Visual Studio 2019 for Mac and Xcode and connect to it from your Windows machine to use it as a remote build machine. The iOS simulator can then be launched from displayed on your Windows machine, which is very cool!
  • iOS Hot Restart: This is a new preview technology that enables you to deploy a debug build of your app directly to your iOS device that is plugged into your Windows machine. This is great if you don't have a mac and want to debug your application and use awesome features like XAML Hot Reload.

Based on your setup and equipment available there is a great option for you to start debugging your iOS app from Windows. Read through the documentation that I linked to for a full setup guide.

Understanding App and Shell

The last thing I want to talk about is what is in our *App and what is in our Shell:

Alt Text

Inside of our App.xaml you will find global resources such as Primary that we used earlier on the button, but also styles such as a global Button style that we are using with states when enabled and disabled. If you open up the App.xaml.cs code behind you will the creationg of the App that is setting the MainPage to our AppShell and also has additional events similar to our page, but for the app such as when it started, went to sleep (aka background), and resumed.

The AppShell.xaml houses the Shell of our application structure. It includes styles and colors for our app shell, and then has additional items for tabs, flyouts, and pages that are displayed. Here we will find two FlyoutItem elements that represent the AboutPage and the BrowsePage. Additionally, it has a MenuItem to display a login/logout button. The ShellContent has a binding to our page that we created and automatically the pages will appear and navigate to each of them when selected.

Flyout Menu on Android

There is a lot more to Xamarin.Forms Shell and creating apps with Xamarin, but hopefully this puts you on the starting path to getting going with your app. Be sure to follow the .NET dev.to account for more entries in this series.

Learn More

There is a lot to learn, but a lot of amazing resources to get you going building apps with Xamarin. Here is a great list to go through:

]]>
Free C# and Xamarin for Beginners Videos Series https://staging.montemagno.com/announcing-free-xamarin-and-c-sharp-for-beginners-videos-series/ 5d97809d0980fc00385d9b5a Fri, 04 Oct 2019 22:00:00 GMT

Last week Hanselman announced all of the great new videos that are available at dot.net/videos. However, he forgot to mention that there is an entire new getting started series for iOS & Android development with Xamarin! The lovely developer advocate's and friends Matt Soucoup and Brandon Minnick just released the 11 part series! If you are new to C# then don't worry as there is a full C# 101 series.

It has never beena better time to get started learning C# and building mobile apps with Xamarin.

GetSTarted-1

The entire series is available on YouTube and Channel 9. And walks you through:

  • What is Xamarin?
  • Installing Xamarin
  • Xamarin Solution Architecture
  • Xamarin.Forms UI with XAML (and with C#)
  • MVVM
  • Navigation
  • Full Recap!

Series

So much more C# .NET!

There are also tons of amazing series available for all things .NET including:

There is SO MUCH GOOD STUFF! Now go off and learn!

]]>
Getting Started with Xamarin and Xamarin.Forms Q&A https://staging.montemagno.com/getting-started-with-xamarin-q-a/ 5a8f07c0fb30940021201f70 Fri, 23 Feb 2018 22:00:00 GMT Every day when I open my inbox or look on GitHub there is always a question or ten for me to answer. I recently got a nice long email from Clifton with a lot of questions and I thought that instead of emailing him back directly that I should write up a blog post with all of my answers for the world to enjoy and add some common questions I get all the time.

2d48e149d28ea2b2ff0328e5cd54c8e2_Xamarin-Inc..zpoh_xamarin-logo-hexagon-blue

Clifton wrote in and said he is investigating cross-platform development with Xamarin and Xamarin.Forms as it is one unified application platform between iOS, Android, and UWP for all form factors. On top of that he is a C# developer that has a lot of experience with XAML in the past.

My first recommendation even before answering his questions would be to read through my "What Xamarin Developers Ought to Know" from last year. It is a great article packed with information.

Also I would recommend that you:

Now here come the questions:

Can I run all emulators for iOS/Android/UWP on Windows 7/8/10 with Visual Studio 2015/2017?

I would likely recommend going with the latest and greatest: Windows 10 and Visual Studio 2017 (Any Edition including Community). This will give you the best compatibility with all of the different platforms and .NET Standard. Additionally, if you want to do UWP development you will need Windows 10.

In general, Visual Studio 2017 and Windows 10 will be the best experience.

As for emulators:

  • UWP: I run apps on my desktop, no need for an emulator there
  • Android: A few options are available. If you NEED hyper-v on then you would need a device or the Microsoft Android Emulators if you don't then I suggest the Intel HAXM hardware accelerated emulators from Google. They are amazing and what I use. Here is our full guide to setting up emulators.
  • iOS: For iOS you will need a mac somewhere on your network to connect to and then you can use our Remoted iOS Simulator for Windows. This is available for all editions of Visual Studio.

Now that said, for iOS development it is important and required that you have a macOS device to do full compilation and debugging. This is a requirement as Xcode only exists on macOS and also it is part of the developer agreement you sign with Apple. You can use your macOS for remote build, compilation, and debugging through Visual Studio 2017. Here is some great documentation.

Don't forget that you don't need a Windows machine to do iOS and Android development. You can do all of it inside of Visual Studio for Mac!

Can I use an inexpensive older Mac (lion) that I can get from Craigslist?

You can buy an older device, but you should ensure that it is able to run the latest version of macOS. This is important because new versions of Xcode only support the latest version and the previous one. So as of this blog post that would be High Sierra and Sierra.

And yes, you will absolutely need a macOS device to do your final compilations and ship to the store, but remember it doesn't have to be the most expensive model. I would of course recommend setting up Continuous Integration and Deployment with VSTS or AppCenter.

My application will require some real-time 3D graphics. I'll mostly be working with cubes, spheres, polygons, and some other slightly more complicated shapes.

No need to go down the OpenTK route, I would look at UrhoSharp for 3D graphics as it works cross-platform and integrates with Xamarin.Forms. It is the latest and greatest.

For 2D graphics I would go with SkiaSharp as it is equally as awesome for 2D and integrates great with Xamarin.Forms!

We actually talked about SkiaSharp on Merge Conflict Episode 66

Additionally, the API is consistent and cross-platform in line with all of the platforms we support.

JavaScript can manipulate SVG and its elements. Do you have libraries that can manipulate SVG and its elements?

There are several libraries out there, but actually you can do all of this with SkiaSharp and here is a great tutorial.

With Xamarin, will I have access to .Net's HttpClient and .Net's Sockets services, which will integrate seamlessly into Xamarin.Forms on all platforms?

Yes, absolutely! We use HttpClient right out of the box! On iOS/Android they go through the native stacks, but you don't have to worry at all because we handle that for you. Just use HttpClient and it will just work! Here are some great docs for working with HttpClient:

On Merge Conflict Episode 37, we actually talked a lot about Http and TLS:

Even more questions!

So, that did it for Clifton, but I figure why not open this up to the community.

So I asked on Twitter:

Here we go:

I love Immo! This is a great question. I would say it is important to know that your .NET and C# knowledge all transfer extremely well to iOS/Android/macOS development with Xamarin. We outline great code sharing strategies that are compatible with all platforms. I like to use MVVM, so if you are coming from a UWP/WPF world it will be very similar.

Know that with Xamarin there are two approaches. Xamarin Native, which is sort of like developing an app for WPF and WinForms. You develop the UI twice natively, but share all your business logic. This gives you 100% API access, 100% of the UI and of course the best performance.

Xamarin.Forms offers up a cross-platform user interface that is based on XAML or C#. This works across iOS, Android, UWP, macOS, and others supported by the community. This XAML is similar as it is XAML, but different as the controls and names are a bit different. However, picking it up is easy and we have great documentation on it.

As far as I know that is not possible. A macOS device is required to build and compile your iOS applications as part of the developer contract that you sign with Apple. Additionally, this is where all of the build tools live with Xcode, simulators, provisioning and more. Make your life easier and pick up a Mac Mini so you can properly debug your app on the simulator or device. Trust me.

For Android there is no issue here as Google ships tools on both Windows and macOS. Xamarin integrates deeply into them with both Visual Studio and Visual Studio for Mac.

Xamarin and the community do a lot of great work creating "Bindings" for iOS and Android libraries so you can access them from C#. All of ours are open source on our Components GitHub page.

We work closely with the community to create "Plugins for Xamarin and Windows" that abstract platform APIs into a single cross-platform API for developers. Things such as preferences, geolocation, taking a photo, audio, etc. You can find a full list on GitHub.

This is well documented, check it out.

We outline all of this on our code sharing strategies documentation, but essentially it is simply and ONLY use .NET Standard 2.0! It gives you everything you could possibly want and more for sharing code.

On Merge Conflict we talk all about this:

I have a subscription to Blue Bottle Coffee specifically their Origins subscription. Every two weeks I am greeted with a delicious 12oz bag of coffee. I brew most mornings in a Chemex, but I switch it up with a ceramic Hario v60 or Aeropress. May I also recommend another podcast I do, Coffeehouse Blunders, where we often chat coffee!

When installing Visual Studio 2017 you should only need the Mobile development with .NET workload:

XamarinWorkload

However, to ensure you have all the UWP and .NET Standard goodness I would install:

  • Universal Windows Platform development
  • .NET desktop development
  • ASP.NET and web development
  • Azure development
  • Mobile development with .NET
  • .NET Core cross-platform development

This is what I have installed on my computer today.

Xamarin (sometimes called Xamarin Native), enables developers to create fully rich iOS, Android, macOS, watchOS, tvOS, and Windows applications in C# and Visual Studio with 100% API coverage of each platform in C#. You develop the UI natively for each platform, but share all your business logic which on average is 60-80% of your application. This approach gives you 100% API access and 100% of the UI and of course the best performance.

Xamarin.Forms offers up a cross-platform user interface that is based on XAML or C# and sits on top of Xamarin Native itself. This works across iOS, Android, UWP, macOS, and others supported by the community. This XAML is similar as it is XAML, but different as the controls and names are a bit different. However, picking it up is easy and we have great documentation on it.

TraditionalvsForms

It is really easy to blend the worlds using Xamarin.Forms Native Pages, which allows you to easily add Xamarin.Forms pages to Xamarin Native application.

With Xamarin you have access to 100% of APIs on each platform and can leverage our binding system to bring in any iOS or Android library into your C# app. We have done tons of them for you already on our Xamarin Components GitHub page, but you can do it yourself with these great docs for iOS and Android.

Almost Done

I thought we were done with questions and then I woke up to so many good ones!

With Xamarin.Forms there is a NavigationService built right in! As long as you have a NavigationPage you can push pages onto the stack. You can also do modals at any time. Here is our full documentation.

page-types

There are a lot of MVVM frameworks out there. Xamarin.Forms includes one right in the box with what should be everything you need (it is all I need and use including a dependency service and messaging center). I would recommend watching Episode 5 of The Xamarin Show: MVVM & Data Binding with Xamarin.Forms.

There are a lot of other ones out there that work with Xamarin including MVVMCross, MvvmLight, and Prism. They all offer different things based on your needs. I wrote a good blog post on them for the the Xamarin Blog.

Jim was able to chime in on this tweet, but think of it like this:

Visual Studio 2017 for Windows:

  • UWP / WPF / WinForms
  • Android + Android Wear/Auto/TV
  • iOS (need mac for final compilation and debugging via remote connection) + tvOS / watchOS
  • ASP.NET / ASP.NET Core / .NET Core

Visual Studio for Mac:

  • macOS
  • Android + Android Wear/Auto/TV
  • iOS + tvOS / watchOS
  • ASP.NET / ASP.NET Core / .NET Core

The core tools and environment of the main OS live on that main OS. You can still open the projects and solutions from either IDE, just the design/compilation part.

Great question and I have already blogged a ton about it!:

Ads:

In App Purchase is always tricky and if you need deep deep integration you should really handle each platform and do what is best practice on each. For my apps I created a Billing Plugin for Xamarin and Windows that does everything cross platform.

Fin

That's it! Thanks to everyone that wrote in and feel free to startup a discussion below!

]]>
Getting Started With & Learning C# https://staging.montemagno.com/getting-started-with-csharp/ 598df8f2c121b60019bf2fe4 Tue, 15 Nov 2016 17:32:43 GMT In 2006, after years of writing C++ and Java code, while attending UAT an instructor named Phil Miller introduced me to this amazing language called C# and changed my life. It was love at first “Hello World” and I have never looked back. C# is an extremely powerful, mature, and extremely cross-platform programming language that I have been using for decades. The beauty of C# of course is that you get this amazing cross-platform framework called .NET, which gives developers ability to perform RESTful service calls, perform math operations, and just about anything else you can possibly think of. With all my C# love I often forget how I learned it all and when I attempt to walk through the basics with new developers I struggle a bit. After talking with a bunch of developers over the last few months I have a 4 step plan when you want to learn C#. I am often extremely interested in how you learned C# and your recommendations, so leave them in the comments.

Learn & Write Some Code in the Browser

That is right! You would think that you would need a full IDE to even start learning and writing C#, but you would be wrong. There is a lovely and amazing website that Microsoft recently published called www.dot.net. Inside of that website is an overview of what .NET is and the languages you can use, but also an amazing learn section, where you can learn about C#, structures, functions, and TONS more…. ALL IN THE BROWSER! There is an interactive IDE/REPL thingy that will take your code and compile it in the cloud (The Azure Cloud).

Here is the direct link: https://www.microsoft.com/net/tutorials/csharp/getting-started

Grab an IDE

You have to write some code somewhere at some point and you have a lot of great options here.

Visual Studio Code

By far this is the most light weight, cross-platform, and easy to install IDE out there. Simply head to code.visualstudio.com and select Code. It works on PC, macOS, and even Linux. When you want to start writing some C# code you will also need the C# extension… the #1 extension. Simply tap on the extension section on the left and search for C#. Done!

Visual Studio Community Edition for PC

We are now in the full IDE world with Visual Studio, the best IDE ever created, and it is completely free! Community Edition is fully featured and allows you to make apps for a plethora of different platforms including mobile platforms such as iOS and Android in C# with Xamarin!

VS is a bigger install so give it some time, but you can select a console app, WPF, UWP, or Xamarin app and you are off to the races. Get it from http://www.visualstudio.com

Visual Studio for Mac

If you are over on a macOS device do not fear as Visual Studio for Machas you covered. While not as verbose as Visual Studio for PC, Visual Studio for Mac focuses on mobile iOS, Android, and macOS apps written in C# with Xamarin in addition to .NET Core, ASP.NET Core, Azure Functions, and even Unity development. This is also completely FREE and easy to install by heading to visualstudio.com.

On the Go with Continuous for iPad

My good friend Frank Krueger is an absolute genius and created his own fully featured C# IDE for the iPad called Continuous. It is the only paid IDE coming in at $9.99, but it is amazing and you can even write full iOS apps in C# with Xamarin with it.

Check out more at http://continuous.codes

Take Bob Tabor’s MVA Class

One of the biggest recommendations that I have heard is the now extremely famous and completely free C# class by Bob Tabor. This free class on Microsoft Virtual Academy has literally changed my friends careers by teaching them C#. Bob is extremely well known and has great classes on a bunch of awesome languages, but his C# is top rated, so check them out right now on Microsoft Virtual Academy.

Pick a Platform & Go

Once you have C# basics down it is time to go pick a platform to start tackling. Write a simple application for web, mobile, or desktop that does one or two things on a single page. With the C# basics down you are able to go off and learn some platform specifics. Here is a good place to start:

Have Fun

C# is my favorite programming language in the entire world and I hope that it soon becomes your favorite too.

]]>