ReSharper 2016.3 Help

Coding Assistance in XAML

Most of ReSharper's coding assistance features are also supported in XAML. You can find the detailed information on these features in the corresponding topics of the Coding Assistance section. In the main topic of the section, you can also find the feature matrix and check what exactly is supported in XAML.

In this topic, you can find some examples of using coding assistance features in XAML:

Syntax Highlighting

ReSharper highlights classes, fields, properties, events, etc. with different colors, so that they can be distinguished easily.

/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Syntax_Highlighting.png

You can establish a custom color scheme. For more information, see Configuring Fonts and Colors.

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.

/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Highlighting__Tooltip_for_color_value.png

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:

/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Code_Completion_02.png
And attributes in XAML:
/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Code_Completion_03.png
Moreover, ReSharper suggests appropriate symbols and actions depending on the context:
/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Code_Completion_01.png

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

ReSharper provides a set of context actions that target XAML code. You can find the full list of these actions in the Code Editing | XAML | Context actions page of ReSharper options. If necessary, you can also disable some of the actions using this page.

As soon as a context action becomes available for the current caret position, ReSharper displays the corresponding action indicator /help/img/dotnet/2016.3/ThemedIcon.ContextAction.Screen.[Gray].png to the left of the caret. Sometimes, however, ReSharper provides several contextually available features for the current caret position. In this case, the action indicator corresponding to the action with the highest priority is shown, and all other actions only appear when you expand the action list by clicking on the action indicator or pressing Alt+Enter Context actions have the lowest priority, therefore, they often appear in the bottom of the action list:

Here are some examples of context actions for XAML:

Convert attribute to nested element
If you want to convert an attribute to a nested element, use this context action.

/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Context_Actions__convert_attribute_01.png

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.
/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Context_Actions__convert_attribute_02.png

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.

/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Context_Actions__convert_tag_01.png

After applying this context action, the tag is converted to the attribute.
/help/img/dotnet/2016.3/ReSharper_by_Language__XAML__Context_Actions__convert_tag_02.png

Last modified: 12 October 2017

See Also