Adding XAML namespace behaviour changed in 5.0 Beta

Hi,

I was going to file a bug for this but I couldn't decide which would be the correct category so I am leaving it here.

When I create a new control in a XAML file and that control's namespace hasn't been imported, R# adds it for me at the top of the file. Version 4.5 R# added it in a new line and it did not mess with the other properties of the UserControl or Window. With version 5.0 Beta, it adds the new namespace after the last namespace but it does not open a new line. It pushes the remaining properties to the right, like this:

Before:

<Window
    x:Class="Workbench.SimpleChartWorkbench"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SimpleChartWorkbench" Height="600" Width="600">
...



After adding a namespace:

<Window
    x:Class="Workbench.SimpleChartWorkbench"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:NewNameSpace.Controls;assembly=NewNameSpace.Assembly" Title="SimpleChartWorkbench" Height="600" Width="600">

This is happening with VS2008. I did not test 2010.

Thanks,
Jose

0
4 comments
Avatar
Permanently deleted user

In 5.0, attribute formatting controlled by XML formatting style, that specified in ReSharper Options. By default, attributes formatted in a single line, but you can choose any other way there.

0

Hi,

Great. I tried and it is solved. I changed the "Attributes format" under Tags to OnDifferentLines.

Cheers,
Jose

0

Hi,

There is a side effect of applying the solution described that I don't remember seeing in 4.5.

In a XAML file when I create a reference to an not yet existent StaticResource, say:


<ComboBox ItemsSource="{Binding xxxField, Converter={StaticResource MyConverter}}"/>


And then apply  "Create resource in parent element yyyy" the new resource is split over two lines as in:



    <UserControl.Resources>
     < MyConverter
x:Key="MyConverter" />
    </UserControl.Resources>


Is there a way to maintain different behaviours depending on context?

Cheers,
Jose

0
Avatar
Permanently deleted user

As of current state, there is no context dependent XML formatting in ReSharper. Sorry.

0

Please sign in to leave a comment.