Refactoring property name in code behind does not propagate to XAML file

I'm trying to refactor the property `MyText` to a new name `HerText` in the following solution:

MainWindow.xaml.cs

using System.Windows;

namespace resharper_refactoring_xaml
{
   /// <summary>
   /// Interaction logic for MainWindow.xaml
   /// </summary>
   public partial class MainWindow : Window
   {
      public MainWindow()
      {
         InitializeComponent();
         MyText = "Blabla";
         DataContext = this;
      }

      public string MyText { get; set; }
   }
}

MainWindow.Xaml

<Window x:Class="resharper_refactoring_xaml.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:resharper_refactoring_xaml"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
   <Grid>
      <TextBlock Text="{Binding Path=MyText}"></TextBlock>
   </Grid>
</Window>

I right click on the property and select Refactor this > Rename. Then I type in a new name for the property, hit Next.

Unfortunately, only the references of `MyText` in the code-behind are renamed. References to `MyText` in the XAML file rename intact.

Why is the rename not propagating to the XAML file? Is there some sort of Resharper setting I might have overlooked?

1 comment
Comment actions Permalink

Have you tried adding a d:DataContext to your XAML?

<Window ... d:DataContext="{d:DesignInstance local:MainWindow}">
1

Please sign in to leave a comment.