Visual Studio’s getting smarter: Renaming in C# and XAML

by brad 23. April 2009 20:06

Once upon a time, when working with ASP.NET WebForms, you could change class names and control names all you wanted in C# (using F2 – Rename) and your .ASPX markup would remain distressingly un-renamed. 

It probably still works that way with WebForms, but for Silverlight projects, Visual Studio 2008 can handle peeking into your XAML to find things to rename.  I don’t know how long it’s been doing this, but it was a pleasant surprise when I first noticed.

Take this value converter for example … DoubleRounderValueConverter. 

6

And this reference to it in my XAML:

CropperCapture[3] 

Now let’s F2 – Rename it.

CropperCapture[7]

Naturally, it ends  up renamed in C#

CropperCapture[5] 

But to my delight, it is ALSO renamed in XAML.  The name is still the original, but that’s okay.  The important part is the class name.

CropperCapture[4]

This is going to save me a ton of time.  (That I can spend copying and pasting Visual Studio screenshots into Windows LiveWriter to make blog posts about how I’m saving time.)

Tags:

Comments are closed

About Brad

Brad Tutterow lives in Illinois and works in Missouri. He has 12 years of experience developing web sites and Windows applications using a variety of technologies and is most excited currently about Silverlight, Windows Phone 7, Halo Reach, and Visual Studio 2010.