I suggest you ...

XAML refactoring, especially for Rename of properties for Databinding

This suggestion is migrated to Developer Community. Please use below link to view the current status.
https://developercommunity.visualstudio.com/content/idea/351173/xaml-refactoring-especially-for-rename-of-properti.html
Currently renaming a property that is databound does NOT rename the binding in the XAML, or the string in the notify property change.

Ex: Currently, When you change MyInt to be something else

Backing ViewModel.cs:

int _myInt;

public int MyInt // Changes
{
get { return _myInt; }
set
{
if (_myInt != value)
{
_myInt = value;
if(PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("MyInt")); /this String does not change
}
}
}
}

SomeXaml.xaml:
<TextBlock Text={Binding MyInt}/> <!-- This MyInt also does not currently update -->

<!-- Other references in Xaml to MyInt also do not change -->

193 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Jim wallace shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Paul commented  ·   ·  Flag as inappropriate

    One part of this suggestion is already obsolete in VS2015. Now instead of "MyInt" one can write nameof(MyInt). This way all refactoring functionality works and there is no need to manually change strings in the code.

  • Clint StLaurent commented  ·   ·  Flag as inappropriate

    ReSharper will do this for you through Refactor-Rename. This alone is worth the <$100 price of the utility/add-on.

  • Julien N commented  ·   ·  Flag as inappropriate

    I guess this is worse : the code I got had a property named "Width" in the ViewModel, which I renamed to a more appropriate name.
    But it renamed ALL the unrelated Width properties of ALL the XAML files of the project to the new name (except in the databinding, in short it renamed everything that shouldn't be and didn't the only one that should...).

  • Jim wallace commented  ·   ·  Flag as inappropriate

    None of my Xaml showed up, I expect because it looks like HTML tags.

    TextBlock Text={Binding MyInt} // this does not change in XAML, nor does any other reference to MyInt

Feedback and Knowledge Base