New Xamarin.Forms XAML IntelliSense in Visual Studio 2017

Pierce Boggan

Visual Studio 2017 version 15.7 is now available, featuring significant improvements to the XAML experience for mobile developers. The Xamarin.Forms XAML editing experience is now powered by the same IntelliSense engine that powers WPF and UWP. This brings several enhancements to developers, including improved matching, binding/commanding IntelliSense, light bulb suggestions, code navigation, linting, resource completion, and markup extension completion.

In this post, we’ll take a look at some of the improvements to the XAML IntelliSense experience.

Matching

As you type, the IntelliSense engine provides suggestions. Unfortunately, if you mistype, or if there are lots of suggestions provided, it can be difficult to find exactly what you need. This release improves the matching around control and property names to ensure you receive the correct suggestion:

  • Fuzzy Matching: The current matching algorithm only looks for exact string matches. Even a minor mistyping can result in no suggestions. The new algorithm will provide matches, even if you mistype. Example: Stck provides a suggestion for StackPanel.
  • Substring Matching: This matching is ideal for scenarios where you know part of the control name, but not the exact name. It’s also useful if you’re looking for groupings of controls. Example: Layout provides suggestions for StackLayout, GridLayout, RelativeLayout, etc.
  • CamelCase Matching: Shortcuts are provided for CamelCase types. Example: SL provides a suggestion for SlackLayout.

Binding Context IntelliSense

When your binding context is set in XAML (as opposed to the constructor of the codebehind), Visual Studio will now provide suggestions when data binding or commanding:

Light Bulb Suggestions

Visual Studio now provides light bulb suggestions for things like missing XML namespace imports:

Resource IntelliSense

Resources that are defined in the page being edited will be available to the IntelliSense service to provide suggestions:

Resources defined at the application level do not currently appear as suggestions.

Markup Extension IntelliSense

Markup extensions, such as Binding, StaticResource, or x:Static, will now appear after opening a curly brace:

XML Namespace IntelliSense

Visual Studio will now provide suggestions when editing an XML namespace:

Linting

Xamarin.Forms XAML will be linted to provide suggestions if the markup is not valid, such as providing two ContentPage.Content values:

Tag Refactoring

This feature will update both the start or end tag of a XAML element as you type:

Share your feedback and suggestions

We need your help to make sure that XAML IntelliSense for Xamarin.Forms inside of Visual Studio 2017 is everything you want it to be. If you experience problems with any of the functionality detailed above, or if you have expectations that aren’t being met by the IntelliSense in Visual Studio 2017 version 15.7, please leave your feedback in this forum thread.

If possible, please provide a sample XAML file, video, and/or reproduction steps. Thanks for helping to make Xamarin tooling better in Visual Studio!

0 comments

Discussion is closed.

Feedback usabilla icon