Today, at Microsoft Connect(); 2018, we have several exciting announcements about brand new capabilities and foundational improvements in the Xamarin platform driven by your generous feedback.
Visual Studio developers everywhere will enjoy updated stable releases of Xamarin with Visual Studio 2017 and Visual Studio 2017 for Mac. We are also giving you the first hands-on preview of Visual Studio 2019, along with Xamarin.Forms 4.0. Below are just a few highlights from today’s announcements:
Xamarin.Forms 3.4 has debuted, bringing you the all-new ImageButton control, new tab index accessibility features, plus 40 more improvements. You have told us loud and clear that you want more powerful UI controls and easier access to customize your native, cross-platform mobile apps. Beginning in version 3.0, we have collaborated closely with contributors to identify the controls and features needed most, define the specifications, review the pull requests, and see them through to shipping. Thank you!
This update is shipping via your favorite NuGet package manager.
Early Preview: Xamarin.Forms 4.0
Shell – A Better Host for your Mobile App
Get a taste of just how easy it is to stand up a cross-platform mobile application with our first preview Xamarin.Forms 4.0. We are ready to unveil Shell, a super simple way to express the structure and navigation for your application in a single file. No more dealing with different page types to handle setting up complicated navigation. And speaking of navigation, Shell provides URI powered navigation APIs to jump to any point in your application instantly, passing data along the way. To learn more about Shell and explore the various features explore our documentation and keep an eye out for a special article on MSDN Magazine later this month.
To showcase using Shell, we have developed a new reference app called Tailwind Traders and released it on GitHub.
Consistent UI with Visual
When it comes to the look of your mobile applications, you have told us that upwards of 90% of the time, you need iOS and Android to look mostly or exactly the same. You backed it up by showing us your applications and talking about the challenges you faced in achieving your designs. To help you achieve your goals of consistent and native UI across platforms, we are introducing Visual. Visual goes much deeper than styles, all the way to providing highly customized renderers that deliver the same look and behavior on both iOS and Android. The first supported Visual is “Material” and our first preview includes implementations of Button, Entry, Frame, and ProgressBar. To get started, set the Visual property on any ContentPage or UI control.
As you can see below, there is still lots of work to be done to unify the default design, and we will continue to improve this as we work through the Xamarin.Forms 4.0 preview cycle. For more information on Visual read our preview documentation.
Note: Visual depends on Android 9.0, Android Support 28 latest version, and target Android 28.
Faster Lists, More Layouts
ListView may have served you well in the past, or it may have shown its limitations early and often. CollectionView aims to help you forget all about ListView by introducing more extensible layout options. It also offers modern native control support for performance and an all-around better API to support your MVVM driven application architecture. By default, CollectionView provides layouts for vertical, horizontal, and grid. You may easily extend this to support your own custom layout. On iOS, it leverages the powerful UICollectionView, and on Android, it leverages the RecyclerView. In addition to being an amazing new control for displaying collections of things, it’s the perfect foundation for a very flexible CarouselView. Both new controls are available today for preview in 4.0. Check our preview documentation to get started.
Cross-Platform Access to Platform Services
Xamarin.Essentials 1.0 is now available for all Xamarin applications! This makes it easier than ever to access non-UI platform APIs from shared code such as geolocation, secure storage, sensors, device information, and many more. For a full list of available cross-platform capabilities, read the docs and keep an eye on the GitHub repository.
To simplify getting started previewing Xamarin.Forms 4.0, we have created a special package of new templates that implement Shell and include Essentials. You can also check the pre-release option in your NuGet package manager and install Xamarin.Forms 4.0-pre1 directly from NuGet.
To enable these new controls, be sure to set these flags just before you start Xamarin.Forms in your MainActivity.cs and AppDelegate.cs.
global::Xamarin.Forms.Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental");
As you have any feedback or find issues, please let us know by filing a GitHub issue.
Android Build Performance & Reliability
In Visual Studio 2017 version 15.9 and Visual Studio for Mac 7.7 we made initial build performance and build correctness improvements. In Visual Studio 2019 and Visual Studio for Mac 8.0 the journey continues as we take more ground in the battle to spend less time building and deploying.
We are also providing support for Android’s next generation packaging tooling that you can learn more about below. To enable this feature, you can add a MSBuild flag in your project’s `.csproj`:
- aapt2 –Divides Android packaging into two steps; Compile and Link. This improves performance for incremental builds and provides earlier error reporting. For example, if there are changes in a single file, you need to recompile only that file.
By enabling this tool in your projects, you enable enhanced performance at both build time and run time.
Android Support Library v28
Starting with Xamarin’s Android Support Library version 28, we are introducing multi-targeting which includes assemblies for older support library versions when your application’s TargetFrameworkVersion is lower than the expected version.
This will allow you to install the Android Support Library to your project regardless of TargetFrameworkVersion and use the latest Android Support Library version that is supported for your application.
Visual Studio Tools for Xamarin
We continue our mission to introduce more stability and productivity for mobile developers. Visual Studio 2019 is now available in preview on Windows and Mac. With this release, you can now run Visual Studio for Mac side by side to help you better evaluate previews while maintaining your stable development environment. For more details about this and pairing Visual Studio 2019 with your Mac build host, give our documentation a read.
While there are many amazing improvements coming in Visual Studio 2019, let’s highlight just a few here including AI-Assisted XAML IntelliSense for Xamarin.Forms, a brand new property panel for Xamarin.Forms, and designer updates to boost your productivity.
AI-Assisted XAML IntelliSense
Today, we are excited to announce AI-assisted IntelliSense for Xamarin.Forms XAML with IntelliCode. IntelliCode augments your IntelliSense experience by recommending commonly used items at the top of the completion list based on your context. Contextual recommendations are based on common practices developed in thousands of open-source code repositories. By predicting the most likely member in the list based on your coding context, AI-assisted IntelliSense stops you from needing to hunt through the list yourself.
IntelliCode for Xamarin.Forms XAML is available to try today – download the IntelliCode Extension for Visual Studio which supports Visual Studio 2017 Version 15.7 and above, and Visual Studio 2019 Preview 1.
Xamarin.Forms Property Panel
You can now edit your Xamarin.Forms XAML control’s properties using the property panel inside of Visual Studio 2019 for Windows. The property panel appears by default in the bottom right of Visual Studio and can be opened by going to the View menu and selecting Properties Window, or by hitting F4. While editing a XAML file, you can see common available properties for the control you’re editing in the property panel. Then edit values for different properties and see your changes reflected instantly in the XAML editor. The property panel is a great tool for seeing what properties are available for your Xamarin.Forms controls and making quick edits to your UI!
Xamarin Android Designer Enhancements
We made several productivity enhancements to the interactions in Split View.
First, we now let you drag and drop directly from the toolbox to the source editor to help quickly scaffold your Android layouts.
Secondly, you can select elements directly from their XML definition span in the source editor. We do this by synchronizing the caret position with the corresponding Android view allowing you to quickly access an element’s properties in the property panel right from the editor.
Lastly, we added an inline color preview to your XML code so you can see what colors are being used in your controls.
If you want to find out more about the resource such as where it’s defined or the hexadecimal value for the color, you can use our quick info feature by hovering over the value.
Xamarin iOS Designer Enhancements
Today in Visual Studio 2019 Preview 1 the iOS designer rolls out several improvements and a few new capabilities including support for:
- Using PDF assets as an image source
- Color spaces and improved color precision
- Selecting named colors from asset catalogs
Android Emulator Improvements
In Visual Studio 2019, we’re making it easier to create new Android emulator images so you can debug your app. New users can create their first image by simply pressing the run icon. Our emulator acquisition experience automatically determines the best configuration for your setup, and takes advantage of hardware acceleration (with Intel HAXM or Hyper-V) and quick boot by default.
Later when you want to create another image, you can select Create Android Emulator from the drop down to open the Android Device Manager.We’ve also continued to work with the Windows team in the Windows 10 October Update to improve the performance of the Android emulator when running on Hyper-V.
Smaller Workload Size
For Visual Studio 2019 we have decreased the size of the Xamarin workload by 50%! We heard that you wanted to get started building mobile apps quicker. Historically a key issue preventing this from happening has been the size (or download time) of the Xamarin workload in Visual Studio 2017. In this release, the Xamarin workload is now just 7.69GB, a 2x reduction from Visual Studio 2017 version 15.9 and a 3x improvement over version 15.7.
This is Just the Beginning!
As the next major version of Visual Studio and Xamarin take shape, we will continue to develop and polish all these improvements. Download them today and don’t be shy to let us know about your experiences.
- Install Visual Studio 2019 for Windows Preview
- Install Visual Studio 2019 for Mac Preview
- Visual Studio 2019 Roadmap
- Visual Studio for Mac Roadmap
- Xamarin.Forms Roadmap
- Android Build Performance Wiki
- Tailwind Traders (GitHub)
- Gastropods Shell (GitHub)
- Shell Gallery (GitHub)
- Team Builder CollectionView (GitHub)