ReSharper 8.0 Web Help

Syntax highlighting

ReSharper highlights classes, fields, properties, events, etc. with different colors, so that they can be distinguished easily.
ReSharper_by_Language__XAML__Syntax_Highlighting
You can establish a custom color scheme. For more information, see Configuring Syntax Highlighting.

Code highlighting

ReSharper detects various problems in XAML files, such as unresolved symbols, incorrect document structure, unused import directives, etc. Whenever a problem is encountered, ReSharper highlights it and displays some description in a tooltip. For more information about ways to find out why the code is highlighted, see Finding Out What is Wrong with Your Code.

In the example below, ReSharper warns that the namespace alias is not used inside the current file and highlights it in grey:
ReSharper_by_Language__XAML__Code_Highlighting_01
In the example below, ReSharper highlights a problem with resolving a method inside an event subscription:
ReSharper_by_Language__XAML__Code_Highlighting_02

Solution-wide analysis

ReSharper does not only analyze errors in the current XAML file, but also inspects all files in the whole solution and shows the results of the analysis in the Errors in Solution window. It takes dependencies between files into account and updates the results when you change code.

ReSharper_by_Language__XAML__Errors_in_Solution

For more information, see Solution-Wide Analysis.

Color assistance

ReSharper highlights color usages with corresponding color and shows additional information on the tooltip. You can also define a color using the palette. For more information, see Color Assistance.

ReSharper_by_Language__XAML__Highlighting__Tooltip_for_color_value

Typing assistance

ReSharper provides a couple of useful features that can save your efforts on typing. So you write more code with less keystrokes.

  • synchronous tag editing - any change of the opening tag is simultaneously applied to the closing tag and vice versa
  • smart slash - as soon as you type the slash at the end of an opening tag, the tag is automatically converted to the empty one

Code completion

ReSharper provides a full set of code completion features as well. So you can complete tags:

ReSharper_by_Language__XAML__Code_Completion_02

And attributes in XAML:

ReSharper_by_Language__XAML__Code_Completion_03

Moreover, ReSharper suggests appropriate symbols and actions depending on the context:

ReSharper_by_Language__XAML__Code_Completion_01


Also, you can complete closing tags. ReSharper provides the list of tags that are not closed at the current caret position.

Examples of context actions

Convert attribute to nested element
If you want to convert an attribute to a nested element, use this context action.
ReSharper_by_Language__XAML__Context_Actions__convert_attribute_01
After applying this context action, the attribute is converted to a child tag with the same value, so that you can provide a more complex value for the property.
ReSharper_by_Language__XAML__Context_Actions__convert_attribute_02

Convert tag to an attribute
If the value of a property is simple, there is no need to have it in a separate tag, so you can convert it to an attribute using this context action.
ReSharper_by_Language__XAML__Context_Actions__convert_tag_01
After applying this context action, the tag is converted to the attribute.
ReSharper_by_Language__XAML__Context_Actions__convert_tag_02

Examples of quick-fixes

Make field private
To change visibility of a field declared in XAML, use the appropriate quick-fix.
ReSharper_by_Language__XAML__Context_Actions__make_private_01
After applying the quick-fix, the value of FieldModifier is changed to private.
ReSharper_by_Language__XAML__Context_Actions__make_private_02

Remove redundant namespace alias
To remove a redundant namespace alias, use the appropriate quick-fix.
ReSharper_by_Language__XAML__Quick-Fixes__remove_redundant_01
After applying the quick-fix, the namespace alias directive is removed.
ReSharper_by_Language__XAML__Quick-Fixes__remove_redundant_02

Remove type qualifier
When the type, to which the style should be applied, is specified in the TargetType attribute, there is no need to add a qualifier for each property of the Button class. ReSharper detects such cases and offers the quick-fix.
ReSharper_by_Language__XAML__Quick-Fixes__remove_type_qualifier_01