Best way to rename MainWindow

In Visual Studio 2010, if I create a new project that is a WPF application, the subclass is MainWindow Windowprovided as the first default window. The steps that I took to rename MainWindoware as follows:

  • Use Solution Explorer to rename MainWindow.xaml.
  • Rename the class to MainWindow.xaml.cs.
  • Select the Rename MainWindow 'to ... option from the Options for Updating Links to a Renamed Object pop-up menu that appears next to the renamed class.
  • Update StartupUriin App.xamlaccordingly.

Is there a better way ?:-)

+5
source share
4 answers
+6

Visual # 2010 Express . , "", "" "Refactor". , , (Calculater ) . Refactor "Rename". , , .

enter image description here

+2

. , , , StartupUri .

It is up to you whether you want to save MainWindow or delete it (which makes sense if you don't use it at all).

+1
source

So I do it:

  • Use Solution Explorer to rename MainWindow.xaml.
  • Ctrl + H to rename the rest of the "MainWindow" ocurrences in the whole solution.
-1
source

All Articles