 Hi, I'm James Montemagno, developer evangelist at Xamarin. Today, we're going to see how you can leverage your C-Sharp and XAML skills to build out native iOS, Android, and Windows applications with Xamarin and Xamarin Forms. We're first going to take a look at the Xamarin platform and the Xamarin Forms library for a complete overview. Then we'll dive into just how you can build out those native iOS, Android, and Windows apps with Xamarin, C-Sharp, and MVVM. Of course, I'll show you where to get started. The Xamarin platform is where Xamarin Forms lives. It's where we're building native iOS, Android, and Windows apps, all in Visual Studio, all with C-Sharp, and all your favorite .NET libraries. And our approach to mobile development is unique. You build a shared C-Sharp back-end, all your business logic, models, view models, RESTful service calls, SQL databases, and then build out a unique iOS, Android, and Windows user interface to build out great user experiences. Now, of course, we have great designers for both iOS and Android built right into Visual Studio, and it's never been easier to get started. Simply when you're installing Visual Studio 2015, select Custom Install, then on the next screen, select Xamarin. Now if you already have Visual Studio installed, head over to xamarin.com. Download for a full universal installer. Now let me introduce you to Xamarin Forms. Xamarin's approach to development is unique. You've got shared C-Sharp back-end, and that doesn't change with Xamarin Forms. It's just a brand new library, enabling you to build a shared UI code base, all in XAML, across iOS, Android, and Windows, to share even more code. Now built right into Xamarin Forms is, of course, 40-plus pages, layouts, and controls that you can access from shared code. But it has MVVM in mind, with 2A data binding, a cross-platform navigation system, an animation API that uses the underlying core animation and Android animation systems, a dependency service, and, of course, a messaging center, all the tools you need to get started with mobile development. There's plenty of pages, such as navigation, tabs, and carousels, to get you off the ground running, and, of course, ways to lay out your controls, stack, relative, grids, scroll views, and you can, of course, nest and bundle this all together. And then there are those controls, sliders, pickers, entries, buttons, anything that you can access from shared code that has an abstraction across iOS, Android, and Windows. It looks a little bit something like this. Let's say I'm creating a login page. I have a stack layout, two entries, and a button that's green that has a command binding to the login command. As we can see on the bottom, we have our iOS, Android, and Windows phone applications, 100% native, all using the shared XAML code base. Let's take a look really quick on how to get started with Xamarin and Xamarin Forms to build out native iOS, Android, and Windows apps, all in XAML. Here we are inside of Visual Studio 2015. When I installed Visual Studio, I also installed Xamarin. So once you have Xamarin installed, you can go to File, New Project, and you're going to see some brand new project templates. You'll have Android, iOS, and under Cross Platform, you'll see our Cross Platform templates. To get started with Xamarin Forms, simply select the blank app for Xamarin Forms with either a portable class library or a shared code project. Now I already have an application set up. It's called MyWeather. We're going to go out, get the current weather for whatever city that we're in, and even get a five-day forecast. So let's go ahead and take a look at the project structure. Here we are inside of Visual Studio and our solution explorer. We have our portable class library with our models, views, and view models, MVVM if you will, and then of course our Android, iOS, and Windows application. Now what's nice here is that all the code that we're going to write is inside of our portable class library. When you create a new Xamarin Forms project, some NuGet packages will get downloaded, such as Xamarin Forms itself, and if you want to use Maps, there's a Maps NuGet package. I've additionally installed some additional NuGet packages, such as Xamarin Insights for Crash Reporting, JSON.net, and a few plugins for Xamarin and Windows, such as Geolocation, Settings, and Text-to-Speech. Let's actually dive into a little bit of code. So it all begins with our weather service, where we're going to query openweathermap.org to actually either get our weather via latitude and longitude, or pass in a city with some units. Additionally, I can go down here and get a full five-day forecast for a specific city that I have. Now what are these weather forecast routes and weather route objects that I'm going to be deserializing? Well, what I did here is I went and I took our Open Weather Map API call, here it is, went ahead and copied it, and back in Visual Studio, I created a whole bunch of weather objects. Now to bring this in, you can easily say Edit, Paste Special, and that JSON we copied, just go ahead and paste it as classes, and all of the classes will be generated for you automatically. Now I've done that ahead of time, so here it is, such as coordinates, weather with our main description or icon, temperature, pressure, wind, and clouds. And we'll see that we'll be data binding to some of these objects. And the key of it here is that, use Xamarin Forms, we're going to create our views all in XAML, but we need some code in the code behind to actually bind to the user interface. And that's where our weather view model comes in. Let's take a look at the top. Here we're implementing INotify property change that I'll get back to later. We're using our weather service, and I have a few properties to bind to, such as the current location that I'm going to enter. If I want to use the city and we're saving these back to our cross-platform settings, don't want to use imperial or metric, our current temperature, condition, and an is-busy indicator to know if I am doing something on the network. Lastly, what we'll have is a command. And when we command, it's essentially when I click a button to get the weather, it will call this execute get weather command. What we can see what I'm doing down here is I have some breakpoints, so we'll remove those. But if I want to use the city, I'll go ahead and pass in the current location to the weather service, and then I do some nice string interpolation to get the forecast, set the temperature and condition, and my user interface will react. If anything goes wrong, I'll notify my users by setting the temp to unable to get weather, and I'll report it back to Xamarin Insights so I can get a little bit of analytics and eventing when something goes wrong. And I can see this warning in my panel. Now all this magic data binding is happening by I notify property change and implementing a property changed event handler. We can use our amazing brand new C Sharp 6 features with the Elvis operator and member body functions to simply invoke it whenever I change a property, let our user interface react. So now we actually want to create a little bit of user interface, and that's where our views come in. I have created a forecast view and a weather view. Let's go ahead and take a look at the weather view. It's simply blank. I have a new content page, and this is all XAML with weather and a binding for the busy indicator. So I have a stack layout. I'm going to stack some controls up. So the first thing that I'm going to do is have an entry, and I'm going to say text here is a binding to location that I'm going to enter. Then we'll go ahead and enter a button, so Xamarin Forms controls, and this will simply say get weather, and the command when it is clicked of a binding to the get weather command. There we go. Now we'll actually display some information when our results have come back and been deserialized. So we can say label, and we'll set the text here to a binding of temp to display the temperature, and we'll set that font size pretty big. Let's set it to 25. Additionally, we can go ahead and specify the condition to see if it's cloudy or sunny outside. So condition, there we go. And the last thing we want to do is create a little activity indicator to let our users know something's happening on the user interface. So let's set the is running. We'll do a binding here to is busy. So only run it if it's busy. And also I'll say make it only visible too when something is happening. There we go. Now we have our user interface in place for our weather page, but we also want to display a full five day forecast. So how could we accomplish this? Well, I have a forecast view and inside of here I have a list view as the main content. This is gonna be bound to a list of items in my forecast. And then I can set a data and item template such as an image cell that's being bound to each item's display temperature, display date and display icon. If I go back to my weather object and scroll down a little bit further, we can see here they are. I'm doing some nice date time parsing, string interpolation to get the temperature and the icon to display. Now to set all this up, it all comes down to the app.cs. This is the main entry point of our application. That's cross platform. So here we have our application and on the bottom we have on start, on sleep and on resume for some lifecycle events. But I'm gonna go ahead and new up my view model and then I'm gonna create a new tabbed page. And the key here to my weather is that I have two views, my weather view and forecast view. I'm setting the binding context to that view model. So when I get the weather, both of the views will react. Then lastly, I'm gonna go ahead and set the main page of my entire application to a navigation page so I get a nice title bar and set the background color and text color as well. Now of course I have still in my solution explorer an Android, iOS and Windows application with the same NuGet packages installed. Now if I need to access some platform-specific code, I can go in here and access 100% of the APIs. But we didn't need to for my weather, everything here is in our portable class library. I've set the Android application as the startup and I have any of the emulators or physical devices and we can just simply start running it. Here we go, the application started and we can see it right here in screen mirroring. I'll go ahead and hit get weather. This will go out, get our temperature. I can slide over to our forecast and we're good to go. Now let's check out the Windows application. I'll go ahead and set that as my startup. This would be my local machine and I'll again start it up. No additional code's been written in the Windows application, it just works with Xamarin forms. Get the weather for Seattle and we can even browse the forecast. Now it's great since it's a universal Windows app is I can go ahead and set the Windows phone emulator as my startup and start that up. And there we go, we get the same Seattle and get weather and I can browse over to my forecast. Last but not least is iOS. Here it is, I already had it installed and I'm screen mirroring back over to my iOS iPhone 6 and get the full forecast available. And there you have it. iOS, Android and Windows from 100% shared code all in XAML and C-Sharp with Xamarin and Xamarin Forms. We just saw how to get started with Xamarin and Xamarin Forms inside Visual Studio 2015. And that's part of the Xamarin platform. But of course Xamarin is your complete mobile solution. The Xamarin platform enabling you to design, develop and integrate all your C-Sharp and .NET code to craft those great native iOS and Android and Windows applications all in C-Sharp. But what happens before you ship your application or even after when you're adding new features? You have great ways of testing with N-Unit or X-Unit but you need a way of testing that user interface. And that's where Xamarin UI test and Xamarin test cloud comes in. Build out automated user interface scripts for any of your iOS or Android applications and ship them to our test cloud to run them on over 2,000 unique iOS and Android devices. But of course what happens after you ship your application to the store? With Xamarin Insights with just a single line of code gives you manage and native crash reports in any of your iOS, Android or Windows applications. We have great resources to get off the ground running started with Xamarin. And of course, we have Xamarin University, our live interactive training with live Xamarin University instructors. Where you maybe know nothing about mobile development or just getting started and become a fully Xamarin certified developer. To learn more about Xamarin University and get a free 30-day trial, go to xamarin.com slash university. And to get started with Xamarin, just head to xamarin.com. You can get the source and samples at xamarin.com slash pre-built and of course, follow me at James Montemagno on Twitter and on GitHub. And thank you so much for watching.