Rename XAML file does not work


  • Here is the following scenario (in a Windows Metro style application in VC++ 11):

    • add a new user control to the project; the wizard generates the following files: UserControl1.xaml, UserControl1.xaml.h and UserControl1.xaml.cpp
    • the UserControl1.xaml.h looks lke this


    namespace TheProject
       public ref class UserControl1 sealed


    • the UserControl1.xaml.xpp looks like this:


    #include "pch.h"
    #include "UserControl1.xaml.h"
    using namespace Windows::UI::Xaml;
    using namespace Windows::UI::Xaml::Controls;
    using namespace Windows::UI::Xaml::Data;
    using namespace TheProject;


    Now, go rename the XAML file. The three files (XAML, h, cpp) are renamed correctly. However, the name of the class and the name of the header in the #include directive remain the same, which leads to compilation errors.

    My opinion is: either support automatic changes in the code when renaming the file, or don't support the rename of the file, or at least do not automatically change the name of the .h/.cpp file behind XAML (if that is actually possible).


    Microsoft MVP VC++ | www.mariusbancila.ro/blog | www.codexpert.ro
    Friday, September 23, 2011 8:33 PM

All replies