Tag Archive : Visual Studio

/ Visual Studio

Wouldn’t be nice if you could try your Xamarin.Forms iOS apps on your Apple device without using a Mac? Yes it would. And now you can!

Follow me and I’ll show you how to deploy your Xamarin.Forms iOS app on you Iphone or iPad without using a Mac thank to Xamarin Hot Restart!


To use Xamarin Hot Restart you need:

  • Visual Studio 2019 16.5 or higher
  • iTunes (64-bit, installed on your PC)
  • Apple Developer account and paid Apple Developer Program enrollment
  • Your Xamarin.Forms app for iOS

Do you have everything?

Let’s start having fun

Remember that Xamarin Hot Reload is still in preview so you will need to enable this feature in your Visual Studio.

To do it, go to Tools > Options > Environment > Preview Features > Enable Xamarin Hot Restart.

Enable Hot Reload

Enable it and remember to restart Visual Studio to actually enable it!


  • Set your iOS project as startup project
  • Set the build configuration to Debug – Iphone
  • In Configuration Manager enable “Deploy” for your iOS project
configuration manager
Enable deploy for iOS

Don’t connect your iPhone/iPad yet (the first time you have to configure this, then it doesn’t matter anymore)

Select “Local Device” and launch your app.

Now follow the instructions and if needed download and install iTunes.

After iTunes is installed, connect your iPhone/iPad to your pc.

Now you need to insert your Apple credentials and then enable the “Automatic provisioning“. This last step is not necessary but trust me, it’s very handy and your machine will automatically setup everything to run the app on your device.

Magic happened

If everything worked (if not you can write here a comment and I’ll try to help you) you will see your device listed among the available devices (where “Local Device” was). Now you can run your app on your local Apple device connected to your pc.

After installing your app on your device, Visual Studio will show a popup telling you to manually run the app. Do it and the popup will disappear and you will be able to test your app on your device.

Xamarin Hot Restart

Not only you can test your Xamarin.iOS app without a Mac, you can now even change your code in real time. After you have done your changes, you just need to press the restart button (next to the stop button on Visual Studio). Visual Studio will compile your changes and quickly relaunch your app. According to Microsoft These are the timing with the new Hot Restart:

Initial BuildInitial DeployIncremental BuildIncremental Deploy
Hot Restart19.49s22.66s2.24s3.89s
w/o Hot Restart163.38s11.24s41.40s8.12s

That’s quite impressive, and you have to consider that it’s just a preview so they can improve it.


  • The Hot Restart works only on Xamarin.Forms and iOS devices, only on a Visual Studio (They will add compatibility for Visual Studio for Mac later).
  • Only 64 bit devices are supported
  • Storyboard and Xib files are not supported
  • Static iOS libraries and frameworks are not supported (your app will crash)
  • You still need a Mac to publish your app on the App Store


Xamarin Hot Reload is just a preview but it’s already a great tool to use. We can now try our Xamarin.Forms app on our Apple devices without using a Mac. I tried it with the app I’m currently working on right now and I’m very impressed. I cannot use storyboards (I don’t) and the app crashed if I open Maps (it’s integrated in the app I’m creating) but other than that it works very well and I’m very excited to try it.

Try it yourself and write in the comments what do you think. If you need any help, leave a comment and I’ll reply asap.

Happy Coding! 🙂

Since ever, one of the most annoying problems of Xamarin Forms on Android was the start up time. A native app takes nothing while even the most basic Xamarin forms apps takes several seconds to show up on Android.

During the years Xamarin has tried hard to make things better, sometimes with very small improvements and other times with a bit better improvements but now with the new Visual Studio release (> 16.5) they did something amazing, something called Startup Tracing with custom Profiles.

Startup Tracing

I’m not going into many details here as the only thing that matters is how we can improve the performances of our Xamarin Forms apps for Android. So I’ll be very clear here. If you go into the Android Options of your Xamarin projects, you’ll see this:

If you enable the AOT Compilation (Ahead of time), your app performances will improve significantly and so the startup time, but your apk size will increase as well. At this point you can decide what is more important for you, performances or apk size.

Don’t answer yet, there is a solution

Since Visual Studio 2019 Version 16.2 you were able to enable the Startup Tracing. If you enable this option, the profiler will do its magic (memory, execution time and some stats) to create a profile for your app to increase the performances without affecting too much your apk size.

According to Xamarin (you can read the full post here), these are the results of enabling these options:

TypeStartup SpeedAPK Size
Normal2s914ms16.1 MB
AOT1s18ms34.6 MB
Startup Tracing1s518ms20.1 MB

It means that AOT is amazing and you should enable it but if you care about the apk size you should definitely enable the Startup tracing as well, so you’ll get an incredible startup speed improvement without affecting too much your apk size.

Amazing but now it’s even better

Since Visual Studio 16.5 (or Visual Studio for Mac 8.5), Xamarin did even better and trust me, the result is more than amazing. I was really impressed by it so do a favour to yourself and continue to read!

We can now generate a Custom Profile of our app! If we do that, the next time our app will run in no time (Cool cool cool cool cool…cit.).

Unfortunately for now there is no UI to generate a Custom Profile (hopefully Microsoft will do it soon), but I’ll show you how to generate your Custom Profile in no time. I’ll try to keep it as easy as I can and as usual, if you have questions or issues, leave a comment here and I’ll reply as soon as possible.

Generate a Custom Profile

Follow this short guide and you’ll get your Custom Profile in no time and you’ll really improve the performances of your Xamarin Forms apps for Android.

  • Open a command prompt in the directory that contains your Android *.csproj file.
  • Connect one (and only one) Android device to your computer.
  • In your Android manifest enable the INTERNET permission.
  • Write and run this command: msbuild /t:BuildAndStartAotProfiling
  • Run your app until is completely loaded (don’t press or do anything on your app!!!).
  • Write and run this command: msbuild /t:FinishAotProfiling (* if you have problems read just below these points)
  • This will create the file custom.aprof to your Android project. Now change the Build Action of this file to AndroidAotProfile.
  • Last step is to add two new properties to your Release configuration:

Enjoy your new amazing performances!

ONLY IN CASE OF ERROR: When running the command msbuild /t:FinishAotProfiling some people (I had it as well on one of my machines) get the error:

aotprofile-tool: Unable to read profile through local port: 9999

If you do, open the Command prompt with admin privileges and (always in the folder containing you Android .csproj file) write:

set PATH=%PATH%;"C:\Program Files (x86)\Android\android-sdk\platform-tools"
msbuild -t:FinishAotProfiling

This will solve the problem and you will be able to have your custom profile.

Again according to Xamarin (you can read it here) this is the result of their tests:

ReleaseRelease/AOTRelease/Startup Tracing (Default)Release/Startup Tracing(Custom)
Activity Displayed4863ms2086ms3655ms1900ms
APK Size48MB95MB57MB60MB


I’ve personally tried the Startup Tracing with Custom Profiles and trust me, the results are impressive, the first time i couldn’t believe my eyes. When we enable these options we can finally obtain startup performances very similar to a native app (similar, not the same…yet!) so may suggestion here is to enable AOT and Startup Tracing and to create a Custom Profile for every project you are going to create! My suggestion is add this page as preferite as you will need it for every project you are going to create. As usual, add a comment and I’ll try to reply asap!

Microsoft has released a new preview version of the new Visual Studio 2019.

The good thing is that it can be installed without affecting your current Visual Studio installation, so if you want to try it now, you can install it for free from here.

We love Visual Studio but in particular we love Xamarin, so let’s see what are the news related to it:

Build and Deploy time

It seems that this new version of Visual Studio brings a massive improvement in Build and Deploy time.

According to Pierce Boggan: “Incremental build times in the Visual Studio 2019 Preview for the SmartHotel360 app are 29.66% better than the Visual Studio 2017 version 15.8 release, and deployment times are over twice as fast

First Build01:04.2000:50.13-21.95%
Incremental Build (XAML Change)00:10.6200:07.47-29.66%
Deploy (XAML Change)00:09.0300:04.44-50.83%

Considering that we spend most of our days building and deploying apps, even few seconds are more than appreciated and here we are talking about 30%. Not bad!

Enhanced Fast Deployment for Android

Visual Studio 2019 Preview 2 adds support for enhanced fast deployment. It means that it will generate a new APK only when necessary.

To enable this feature, add these lines to your Android file project:



In Visual Studio 2019 we can use a property panel to help us writing our XAML files. We just need to select a control and all its properties will appear in the property panel.

XAML IntelliSense

Visual Studio 2019 has a better IntelliSense and will include IntelliCode that will recommend us the common items putting them on top of the completion list according to the context.


The Android designer adds support for Android Pie (9.0) while now IntelliSense is supported for Android XML files.

The iOS Designer adds support to render custom controls that need to load native dynamic libraries or frameworks.

What else

Visual Studio 2019 produces faster Android Apps with smaller APKs thanks to d8 and r8.

To enable these two features add these lines to your Android project file:





Visual Studio 2019 also adds the Xamarin Forms Shell Template.

There are many other improvements to Visual Studio 2019, so I’ll suggest you to try it and maybe give your feedback to Microsoft.

What do you think about Visual Studio 2019 Preview 2? Tell us writing a comment…

Sometimes we need to show a custom value in our XAML and this operation is not always immediate but with this tutorial you’ll discover how easy it is.

Let’s say that in our photo app we have a setting for the size of our photo. We store this setting as an integer but of course we want to show a better information to the user. Let’s say that

  • 0: Small
  • 1:Medium
  • 2: Large
  • 3: Full Size

This is what we want to achieve (Image Size):

A first idea could be to add a label with a simple text and to change the text from the code behind. Something like this:

<Label  Text="{Binding MyText}"/>

But we are better developers than that so we want to use an integer and a Converter:

<Label  Text="{Binding ImageSize, StringFormat='Image Size ({0})', Converter={StaticResource IntToImageSizeConverter}}"/>

As you have seen, instead of using a text, here we use our integer value, a converter and a StringFormat to format our text.

In our converter we receive an integer value and we return an element of the PhotoSize enum. This is the source code of the converter:

IValueConverter implementation public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            if (value is int b)
                switch (b)
                    case 0: return PhotoSize.Small;
                    case 1: return PhotoSize.Medium;
                    case 2: return PhotoSize.Large;
                    case 3: return PhotoSize.Full;

            return value;

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            throw new NotImplementedException();

The latest thing to do is to register the converter in our dictionary:

<helpers:IntToImageSizeConverter x:Key="IntToImageSizeConverter"/>

With this code we can use our integer variable to show a more meaningful text. Easy. Isn’t it?

If you want to know more or you need more info, write a comment here. If you liked the article share it!

Finally the new version of Visual Studio 2017 is here.

Visual Studio
Visual Studio 2017

As usual let’s see the new features inside this releases and the changes for Xamarin:

  • You can now import and export an installation configuration file that specifies which workloads and components should be installed with an instance of Visual Studio.
  • We have improved the debugging experience for NuGet packages using the new symbol package format (.snupkg).
  • Step back in debugger is now available in C++ for Enterprise customers.
  • C++ IntelliSense now responds to changes in the remote environment for both CMake and MSBuild projects targeting Linux.
  • We have made updates to UWP Desktop Bridge framework packages and added support for ARM64 C++ Native Desktop scenarios.
  • We added support for the range-v3 library with the MSVC 15.9 compiler.
  • We fixed several bugs in the F# compiler and F# tools.
  • Language service support for new TypeScript features for semantic file renaming and project references.
  • Improved Node.js development by updating Vue.js templates and adding support for unit testing using the Jest framework.
  • We added SharePoint 2019 project templates, so you can migrate existing SharePoint 2013 and 2016 projects to SharePoint 2019.
  • Visual Studio Tools for Xamarin now supports Xcode 10.
  • We made improvements to the Xamarin.Android build performance.
  • We have added and improved features for Universal Windows Platform developers, including ARM64 support, the latest preview SDK, better debugging of Desktop Bridge applications, and XAML Designer improvements.
  • Substantial improvements were made to the experience of using authenticated package feeds.
  • There is now support for lock file to enable repeatable restore for PackageReference based projects.
  • We have added support for the new license format for NuGet packages.
  • We have introduced NuGet client policies in Visual Studio which enables you to lock down environments such that only trusted packages can be installed.
  • We made the use of .NET Core within Visual Studio more predictable.

and these are the bugs fixed in this version:

  • No way to change “Find All References” background color.
  • “Visual C++ Resource Editor Package” load failed.
  • VS2017 v15.8 Build does not start if XAML files are not manually saved first.
  • Installation failed – manifest signature verification failed.
  • Update 15.8.6 breaks Installer Projects.
  • Scrolling up with the arrow key causes Visual Studio to page up.
  • After updating to 15.8.1, data tip does not show when debugging.
  • System.InvalidProgramException: Common Language Runtime detected an invalid program..
  • Solution Explorer does not remain pinned after closing Visual Studio.
  • Navigation bar in editor has trouble handling long method names.

Regarding Xamarin these are the most important changes in this release:

Visual Studio Tools for Xamarin

Visual Studio Tools for Xamarin now supports Xcode 10, which allows you to build and debug apps for iOS 12, tvOS 12, and watchOS 5. See how to get ready for iOS 12 and our introduction to iOS 12 for more details on the new features available.

Initial Xamarin.Android Build Performance Improvements

Xamarin.Android 9.1 includes initial build performance improvements. You can see the build performance comparison here.

To download Visual Studio 2017 or to see the entire release notes, you can follow this link: Visual Studio 2017 release notes.

Microsoft has now released a new update for Visual Studio 2019. Let see what news we are and if there are improvements for Xamarin (Yes, there are…Yes!!!!)

As usual I’ll copy here Microsoft Release notes (it’s quite long, so I’ll keep only the important part) and then we’ll see the improvements for Xamarin. I’ve added in bold the parts related to Xamarin.

Release Notes Visual Studio 2019 version 16.1


  • Visual Studio IntelliCode is now generally available and comes installed with any workload that supports C#, C++, TypeScipt/JavaScript, or XAML.
  • We have added Per-Monitor Awareness support.
  • New codefixes are available for C#.
  • Most Recently Used has been added to Visual Studio Search.


  • You can now experience optimizations to improve the solution load time of very large solutions.
  • Template authors can add custom tags to their templates.
  • There is now CodeLens support for custom UI.
  • We have provided updates to Language Server Protocol implementation.
  • We have updated behavior for switching between solutions, folders, and other views.


  • In-editor documentation for CMake has been added.
  • Use Windows Subsystem for Linux with C++ natively in Visual Studio, and AddressSanitizer for Linux projects and WSL.
  • We have made improvements and modified colorization in C++ Quick Info tooltips.
  • We have implemented new C++ Code Analysis quick fixes.


  • We have released more performance improvements and a bulk of bug fixes for F# and F# tooling.


  • New .NET productivity features include one-click code cleanup on projects and solutions, a new toggle block comment keyboard shortcut, refactoring to move types to other namespaces.
  • You can now clone code from an SSH URI through the clone screen in the start window.
  • .NET Productivity additions in this release include intellisense completion for unimported types, toggling single-line comment/uncomment, exporting naming styles to editorconfig, and a new code style setting for preferring usings inside/outside namspaces.
  • We have implemented .NET SDK tooling additions primarily around supporting WinForms and WPF projects for .NET Core 3.0 along with bug fixes and performance improvements.
  • Visual Studio SDK v16.0 has been released to NuGet.
  • A preview of the XAML Designer for .NET Core 3.0 WPF development is available.


  • Default Android Experience for Xamarin now supports API 28.
  • Xamarin.Forms XAML recommendations for design time attributes.

Top Issues Fixed in Visual Studio 2019 version 16.1

  • Cannot navigate to the symbol under the caret in ASP.NET MVC Projects.
  • Resx editor doesn’t render.
  • Xamarin.iOS cannot find the application manifest. Please ensure the project contains a manifest file named ‘Info.plist”.
  • nmake environment missing path to NETFX tools.
  • Clicking on a ASP.NET Core project in solution opening the project .csproj file.
  • Assembly reference is removed from project after running app referencing library.

Details of What’s New in Visual Studio 2019 version 16.1


  • IntelliCode is now generally available and comes installed with any workload that supports C#, C++, TypeScipt/JavaScript, or XAML.
  • Use the start window to clone code from an online repository through SSH.
Clone with SSH on start window

Clone with SSH on start window

  • Visual Studio IntelliCode is installed by default when you install a workload that supports C#, XAML, or C++.
    • C# and XAML base models will be on by default.
    • Preview features, such as custom model training and argument completion, can be enabled via Tools > Options > IntelliCode.
  • Added Per-Monitor Awareness support
  • New codefixes available for C#.
  • Added Per-Monitor Awareness support for WinForms based PropertyBrowser window of Visual Studio. Requires .NET Framework 4.8 RTM version installed on the machine.


  • Source Link can now use Windows Authentication to support on-premises TFS Source Control.
  • Added nuget.org symbol server to the list of default symbol servers


  • The button for switching the Solution Explorer view will now consistently show you a dropdown menu of all possible views.
Solution switching

Solution view switching

  • Improved the loading time for very large solutions. The improvement varies based on the size of the solutions.
  • Removed the Convert dialog under File > Convert. This feature was previously deprecated in Visual Studio 2015.
  • Updated the validation rules for the task.vs.json and launch.vs.json schemas, and added descriptions for the properties.
  • Added support for Linux remote debugging using a custom program via launch.vs.json.


  • Visual Studio Search will now display on focus the three most recently used actions invoked through Visual Studio Search, as shown in this sample mockup. (Note: icons and specific line items have not been fully updated in this mock-up.)
Visual Studio Search

.NET Productivity

  • There is now experimental intellisense completion for unimported types! You now receive intellisense suggestions for types in dependencies in your project even if you have not yet added the import statement to your file. You must turn this option on in Tools > Options > Text Editor > C# > Intellisense.
Intellisense completion for unimported types

Intellisense completion for unimported types

  • Toggle Single Line Comment/Uncomment is now available through the keyboard shortcut (Ctrl+K,/). This command will add or remove a single line comment depending on whether your selection is already commented.
  • You can now export naming styles with the “Generate editorconfig” button located in Tools > Options > Text Editor > C# > Code Style.
  • You can now use a new editorconfig code style rule to require or prevent usings inside a namespace. This setting will also be exported when you use the “Generate editorconfig” button located in Tools > Options > Text Editor > C# > Code Style.
Editorconfig rule for usings outside/inside namespaces

Editorconfig rule for usings outside/inside namespaces

Tools Options setting for usings inside/outside namespace

Tools Options setting for usings inside/outside namespace

  • The Find All References “Kind” column now has more filter options and is aware of namespaces and types.
Find All References Kind column has more filter options

Find All References Kind column has more filter options

  • We have added a codefix for split/merge if statements.
Split or merge if statements

Split or merge if statements

  • We have added a codefix for wrapping binary expressions.
Wrap binary expressions

Wrap binary expressions

  • A regex completion list can now be accessed through the intellisense menu (Ctrl + space) when inside a regex string. These completions also include an in-line description of what the suggestion does.
Regex completion offered in Intellisense with (Ctrl + space)

Regex completion

  • We have added a codefix for unsealing a class.
Unseal a class codefix

Unseal a class

  • You can now use one-click code cleanup for projects and solutions. You can right-click on projects or the solution in the Solution Explorer and select ‘Run Code Cleanup’.
Right-click to run code cleanup over the entire solution

Right-click to run code cleanup over the entire solution

You will see a dialog box while cleanup is applied to each file

You will see a dialog box while cleanup is applied to each file

  • You can now use a refactoring dialog to move type to namespace or folder. Place your cursor in the class name and type (Ctrl + .) to open the quick actions and refactorings menu and select ‘Move to namespace.’ This launches a dialog where you can select the target namespace you would like to move the type to.
Place cursor in class name and type (Ctrl+.) to view refactorings

Place cursor in class name and type (Ctrl+.) to view refactorings

Select the destination namespace

Select the destination namespace

  • Toggle Block Comment/Uncomment is now available through the keyboard shortcut (Ctrl+Shift+/) or through Edit > Advanced > Toggle Block Comment. This command will add or remove block comments depending on what you have selected.
Toggle block comment with (Ctrl+Shift+/)

Toggle block comment with (Ctrl+Shift+/)

  • There is now a codefix for making readonly struct fields writable. Place your cursor in the struct name, type (Ctrl+.) to open the quick actions and refactorings menu, and select ‘Make readonly fields writable.’
  • The codefix to add a private field from a constructor and vice versa is easier to discover and will show when any portion of the field name is selected. This refactoring now also offers all possible constructors.

XAML Designer Preview for .NET Core 3.0 WPF development

  • There is an early preview of the XAML Designer for developers building .NET Core 3.0 WPF applications in Visual Studio. Many design-time features will be unavailable at this time. Since this is an early preview, if you encounter issues such as crashes, please submit Visual Studio feedback for the team to improve the experience going forwards.
  • With each update to Visual Studio 2019, we will continue implementing more of the features that were previously available in the XAML Designer for .NET Framework WPF applications.


  • We have updated the default Android Experience to API 28 for templates, device creation, installers, and more.
  • IntelliSense on Windows now shows recommendations for design-time attributes when writing Xamarin.Forms XAML.

Changes related to Xamarin

As we have seen, there are 2 main changes. The first one is relative to Android, now everything is updated to API 28, so we should find updated Android templates.

The second change is relative to IntelliSense, now it should give us better recommendations when we write our Xamarin.Froms XAML files.

A very annoying bug has been fixed in Xamarin.iOS: Xamarin.iOS cannot find the application manifest. Please ensure the project contains a manifest file named ‘Info.plist”.

That was quite a bad bug and the only way to resolve it was to unload and reload the iOS project. Fortunately now Microsoft has fixed it so…..Yeahhh!

Are you going to update Visual Studio? I’m doing it right now!

For a list of all changes, please visit this page: https://docs.microsoft.com/en-gb/visualstudio/releases/2019/release-notes#16.1.0

N.B. The images were taken from the page above. So the copyright belongs to them

Xamarin.Forms 4.0 is finally out

May 22, 2019 | News | No Comments

Every release of Xamarin.Forms improves the performances and adds new features. It has been a long time since the first Xamarin.Forms came out. That version was very basic and to be honest not very great. Then Xamarin.Forms 2 came out and it was better, finally something that could be used for a production app. When Xamarin.Forms 3 came out, it was great, better performances, new features. Xamarin.Forms 3 has been a great tool to create amazing multiplatform apps and now Xamarin.Forms 4.0 promises even more, again better performances and new features. Let’s see together the main news of this release.

The Shell

Shell is a new way to create our apps. First of all it allows us to add easily flyouts and menus to our apps. It also adds the concept of URI navigation.

That’s great but what is even better is that it uses “fast renderers” (see later). To use the shell, on Visual Studio 2019 starting a new Xamarin.Forms app, you can select the Shell template. To get more info about Shell, you can use this documentation:

Android Fast Renderers

Android Fast Renderers were introduced in Xamarin.Forms 2.4 but disabled by default. The idea behind them is to reduce the number of views required to render a particular control. Honestly you could see improved performances so now they are enabled by default. This means that you will notice better perfomances with the enw Xamarin.Forms.

Image Source Unification

From Xamarin.Forms 3.5, they have introduced the FontImageSource to use the font glyphs but was not possible to use it everywhere. From version 4.0using ImageSource you can use them wherever you want.


From Xamarin Forms 4.0 we can now control the focus order directly in X.F. To do this, we can use the TabIndex property available on any VisualElement.


I will personally test Xamarin.Forms 4.0 and in particular the Shell to see how great that is. I will also test the new navigation pattern (URI Navigation) to see if there are improvements here. I will also evaluate the new performances to see if the app can be faster or more fluid.

And what do you think about Xamarin.Forms 4.0?

If you are using the Syncfusion library together with Xamarin.Forms > 3.4 you should definitely continue to read.

Since the new release of Xamarin.Form 3.5, if you try to use the Syncfusion Listview (SfListView) in Release mode on Android, your app will crash.

In this moment there are two things that you can do:

  • Use a version of Xamarin.Forms < 3.5
  • Set the Linking to None (in this case your final APK will be bigger than usual).

Unless you are using some of the new features of Xamarin.Forms > 3.4, I’d suggest you to continue to use Xamarin.Forms 3.4 otherwise in you Android project, set the Linking to None and it will solve your problem.

I will update this post, as soon as Synfusion and Xamarin will solve this massive issue.

Meanwhile you can follow the progress of this bug here: https://github.com/xamarin/Xamarin.Forms/issues/5288

Basically all the apps use a Listview to show one or more list of items.Sometimes you want to change the appearance of your items according to some parameter (for example inside the same page, sometimes you want to show partial forms, other times completed forms and so on).Let’s see how easily you can achieve this in Xamarin.


First of all, we need to add a listview in our page:

<ListView ItemTemplate = "{Binding MyTemplate}" ItemsSource="{Binding MySource}" HasUnevenRows="True" VerticalOptions="FillAndExpand"></ListView>

With these few lines of code we have added a ListView that will vertically fill our page. We have also specified the ItemSource (the items we want to add to our listview), the ItemTemplate (the template to specify the appearance of our items) and set HasUnevenRows (true if we have items with different height, false otherwise).The UI is really easy! Isn’t it? Now let’s see how to specify the template.


Inside the ViewModel connected to our page we need to load MySource and MyTemplate:

public DataTemplate MyTemplate { get; set; }
        public ObservableCollection<MyItems> MySource { get; set; }

        public ListOfMyItemsViewModel(ItemType itemType)
            MyTemplate = GetTemplate(itemType);
            MySource = new ObservableCollection<MyItems>(LocalData.GetMyItems(itemType));

        private DataTemplate GetTemplate(ItemType itemType)
            switch (itemType)
                case ItemType.ItemType1: return new DataTemplate(typeof(CellType1));
                case ItemType.ItemType2: return new DataTemplate(typeof(CellType2));
                case ItemType.ItemType3: return new DataTemplate(typeof(CellType3));
                case ItemType.ItemType4: return new DataTemplate(typeof(CellType4));

            return null;

Inside the constructor we have specified the Template  for our cells and then we have loaded the Items.In this specific case (GetTemplate) we can load 4 different types of cell but of course we can have as many templates as we want. CellType1, CellType2, CellType3 and CellType4 are of type:  ViewCell. It’s important to note that in this example we have set the template inside the constructor (so when the page is loaded) but we can set it whenever we want so that for example we can change the appearance of our cells pressing a button or maybe selecting a value from a picker.


With this few lines of code we can dynamically set the cell appearance in  our listview according to the type of cell we want to load (specified in our case by itemType). 

Questions? Leave a message or send me an e-mail and I’ll answer you.

Finally a new version of Visual Studio is here and it seems great.

Visual Studio
Visual Studio 2017

As usual let’s see the release note from the Visual Studio website.

Release Note:

  • We added support to change installation locations.
  • You can Save All your pending changes before you start your update.
  • The update dialog provides you even more details about your update during installation.
  • C# 7.3 is included in Visual Studio version 15.7.
  • We improved solution load time for C# and VB projects.
  • We made numerous updates to F# and its tools, with a focus on performance.
  • We reduced the time to enable IntelliSense for large .NET Core projects by 25%.
  • We made Quick Info improvements and new .NET refactorings like convert for-to-foreach and make private fields readonly.
  • We added the ability to publish ASP.NET Core applications to App Service Linux without containers.
  • Live Unit Testing works with embedded pdbs and supports projects that use reference assemblies.
  • The Test Explorer has more responsive icons during test runs.
  • C++ developers can use CodeLens for unit testing.
  • We added new rules enforcing items from the C++ Core Guidelines.
  • Debugging large solutions with /Debug:fastlink PDBs is more robust.
  • CMake integration supports CMake 3.11 and static analysis.
  • Python projects support type hints in IntelliSense, and a Run MyPy command has been added to look for typing errors in your code.
  • Conda environments are supported in Python projects.
  • We added a next version of our Python debugger based on the popular open source pydevd debugger.
  • TypeScript 2.8 is included in Visual Studio version 15.7.
  • We improved Kestrel HTTPs support during debugging.
  • We added support for JavaScript debugging with Microsoft Edge.
  • The Debugger supports VSTS and GitHub Authentication for Source Link.
  • IntelliTrace?s step-back debugging feature is supported for debugging .NET Core projects.
  • We added IntelliTrace support for taking snapshots on exceptions.
  • We removed the blocking modal dialog from branch checkouts in Git when a solution or project reload is not required.
  • There is an option to choose between OpenSSL and SChannel in Git.
  • You can create and associate Azure Key Vaults from within the Visual Studio IDE.
  • Visual Studio Tools for Xamarin can automatically install missing Android API levels required by Xamarin.Android projects.
  • The Xamarin.Forms XAML editor provides IntelliSense and quick fixes for conditional XAML.
  • We added support for Azure, UWP, and additional project types in Visual Studio Build Tools.
  • You can create build servers without installing all of Visual Studio.
  • The Windows 10 April 2018 Update SDK – Build 17134 is the default required SDK for the Universal Windows Platform development workload.
  • We added support for Visual State Management for all UWP apps and more.
  • We enabled automatic updates for sideloaded APPX packages.
  • You have new tools for migrating to NuGet PackageReference.
  • We added support for NuGet package signatures.
  • We added Service Fabric Tooling for the 6.2 Service Fabric release.
  • We updated Entity Framework Tools to work with the EF 6.2 runtime and to improve reverse engineering of existing databases.

And now let’s see the improvements around Xamarin:


  • In this release, we improved solution load time for C# and VB projects by an average of 20%.

Visual Studio Tools for Xamarin

This release includes Xamarin.Android 8.3 and Xamarin.iOS 11.10.

Automatic Android SDK Management

When a Xamarin.Android project is loaded, Visual Studio can determine if the Android API level used by the project is missing from your machine and automatically install it for you in the background. To enable this feature, go to Tools > Options > Xamarin > Android Settings > Auto Install Android SDKs.

Improved XAML IntelliSense

Xamarin.Forms developers using Visual Studio 2017 version 15.7 will notice a vastly improved IntelliSense experience

Automatic iOS Provisioning

We made iOS device provisioning for development easier. In Visual Studio 2017 version 15.7, there’s a streamlined experience to request a development certificate, generate a signing key, add a device in the Developer Center, and create a provisioning profile, all with a single button click. All the heavy lifting of provisioning an iOS device is handled for you in less than 30 seconds.

I really think you should update Visual Studio to the new version 15.7. The improvements around Xamarin are really impressive and very useful.You can read all about the new update here: https://docs.microsoft.com/en-gb/visualstudio/releasenotes/vs2017-relnotes

%d bloggers like this: