Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename Control in XAML

I want to rename a WPF Control in XAML and want all References in C# Code-behind to be renamed. Like I can do in class files with F2.

A free solution would be nice. I know that ReSharper does the Job, but ReSharper is not free.

If this is possible, how do I do it?

like image 558
Florian Avatar asked Oct 23 '13 12:10

Florian


2 Answers

3 solutions for you:

  • Open your solution in Expression Blend for Visual Studio (bundled with VS2013) and rename the control using the Properties window. Blend is very good at renaming XAML elements.
  • Just rename it and fix the compile errors by hand.
  • If you are confident that your control name is unique, do a find & replace operation upon it.
like image 143
Gusdor Avatar answered Oct 15 '22 04:10

Gusdor


If you use the Refactor Rename command in the C# code, it will rename it in XAML also.

Edit menu > Refactor > Rename, at least in VS2015

Unfortunately this same command doesn't work from XAML (it does nothing).

like image 43
StayOnTarget Avatar answered Oct 15 '22 04:10

StayOnTarget