In Visual Studio 2010, if I create a new project that is a WPF Application, the MainWindow
subclass of Window
is provided as a default first window. The steps I've been taking to rename MainWindow
are:
MainWindow.xaml
.MainWindow.xaml.cs
. StartupUri
in App.xaml
accordingly.Is there a better way? :-)
- Get ReSharper
- Use Rename
- ????
- Profit
Visual C# 2010 Express Has a built in option to solve this.You can see the menu bar has an option "Refactor" where you can see two sub-menu Rename and Refactor.To change any name you just have to take the cursor on the name(Calculater in image) and click right button.Then go to Refactor and click Rename.You will see a dialog box comes and then you put the new name you want to give to your attribute.
MainWindow
, you'll still have to up date StartupUri
manually. But it's good that you mention this feature, for completeness - dharmatech 2012-04-19 21:36
I cannot think of a better way. An alternative which may result in less steps could be to create a new window and then set the StartupUri to the name of your new window.
It is then up to you whether you want to keep MainWindow or delete it (which would make sense if you are not using it at all).