XAML Improvements in ReSharper 8.1

Double completion meets XAML

As one of the code completion improvements in ReSharper 8, we introduced a powerful and easy-to-use concept called double completion. When working with C# or VB.NET, should the code completion list fail to provide the item you need in particular context, you can just hit Ctrl+Space one more time to extend the completion list either with items that were previously filtered out or with items whose references to be imported (this paradigm also applies to import and smart completion).

XAML editor code completion in ReSharper 8.1 now shares the same idea. Completion of a property element has now become simpler than ever — just type a part of the property name inside the XAML object tag and invoke double completion, no type name of angle brackets required:

Double completion of XAML attribute values now allows referencing currently available resources of applicable type in just a few steps:

Windows 8.1 XAML Application Development Support

Speaking of resources, ReSharper 8.1 now is aware of the {ThemeResource} XAML concept introduced in Windows Store applications for Windows 8.1 to help with the theming of applications. Predictably enough, ReSharper now offers the features one would expect, such as Go to Declaration, Find Usages and refactorings (Rename, Inline, Extract) of these types of resource references:

Import Types on Paste

Refactorings in ReSharper are even more beneficial when they monitor your editing activities and offer themselves opportunistically. For example, when you are reordering parameters of a method with copy & paste, using the Rearrange Code feature, or manually introducing new parameters or removing existing ones, ReSharper shows a dashed outline and suggests using the Change Signature refactoring to update usages of the method consistent with your changes:

While previously ReSharper was able to detect inline renames of resources and x:Name fields declared in XAML, we are now extending this with the import types on paste feature. You can easily move parts of your XAML markup between files, and ReSharper will fix the type usages for you if required, introducing all the required namespace aliases to keep your code valid in its new location:

File Structure Revisited

We are constantly looking for ways to improve our existing features to make them more useful. This is why the XAML code structure was rewritten from scratch, just like the JavaScript file structure support in ReSharper 8. Now it filters out unimportant things like namespace alias declarations, shows a preview of XAML attributes and tags’ inner values near the tree elements, collapses style setters for better readability, and a lot more:

Typing Assistance

Another thing we did is we extended the small typing assistance feature called smart braces to support pair insertion and removal of XAML attribute quotes and markup extensions braces:

It has become even more important to have this feature, as many developers prefer using the source code editor in Visual Studio to make XAML editing much more responsive. Unlike Visual Studio, ReSharper XAML typing assistance features work for both editors. The smart quotes feature is also available in the XML editor.

Some context actions have become so frequently used in XAML editing, that they became typing features. For example, in ReSharper 8.1, just by hitting the Enter key inside an empty attribute value, you can convert the attribute to a nested property element:

Other Improvements

Every ReSharper release comes with lots of fixes in all the supported languages and functionality, and the release of 8.1 contains fixes for 50+ XAML-related issues. The list includes fixes for XAML 2009 support, support of .xoml files in the Microsoft Unified Communications SDK, and even special knowledge about WPF 4.5 binding to static properties (static events related to static properties are treated as used members):

So with that in mind, we hope you enjoy the new XAML support. To see it in action, download ReSharper 8.1 and give it a go.