如何使用WPF在Visual C#2008中获取自定义应用程序名称和启动窗口名称?

时间:2023-01-24 16:21:01

I'm using Microsft Visual C# 2008 and am creating WPF applications. If you create a new solution and pick the WPF application template it lets you provide a single string to name the solution.

我正在使用Microsft Visual C#2008并正在创建WPF应用程序。如果您创建新解决方案并选择WPF应用程序模板,则可以提供单个字符串来命名解决方案。

It then automatically turns that string into a base project name and a namespace using underscores instead of spaces. It also generates a class that inherits from the application class named App and a starting window with a Grid control in it named Window1.

然后它使用下划线而不是空格自动将该字符串转换为基本项目名称和命名空间。它还生成一个继承自名为App的应用程序类的类,以及一个名为Window1的Grid控件的起始窗口。

I want to customize pretty much everything.

我想要自定义几乎所有东西。

What's the simplest method of renaming App, Window1, and the starting namespace which won't corrupt the Solution?

重命名App,Window1和不会破坏解决方案的起始命名空间的最简单方法是什么?

1 个解决方案

#1


2  

Follow these steps:

跟着这些步骤:

  1. Rename the application and window .xaml's in the solution explorer.

    在解决方案资源管理器中重命名应用程序和窗口.xaml。

  2. Edit the application's .xaml (App.xaml originally) so the StartupUri points to the new name of the starting window the line will be as follows:

    编辑应用程序的.xaml(最初为App.xaml),以便StartupUri指向该行的起始窗口的新名称,如下所示:

    StartupUri="Window1.xaml"

  3. Edit in the original window's .cs codebehind window so Window1 becomes the new window's name.

    在原始窗口的.cs代码隐藏窗口中编辑,以便Window1成为新窗口的名称。

  4. Use the mouse on the drop-down after the new window name to copy the changed name elsewhere.

    在新窗口名称后面的下拉列表中使用鼠标将更改的名称复制到其他位置。

  5. Edit the title of the window.

    编辑窗口的标题。

#1


2  

Follow these steps:

跟着这些步骤:

  1. Rename the application and window .xaml's in the solution explorer.

    在解决方案资源管理器中重命名应用程序和窗口.xaml。

  2. Edit the application's .xaml (App.xaml originally) so the StartupUri points to the new name of the starting window the line will be as follows:

    编辑应用程序的.xaml(最初为App.xaml),以便StartupUri指向该行的起始窗口的新名称,如下所示:

    StartupUri="Window1.xaml"

  3. Edit in the original window's .cs codebehind window so Window1 becomes the new window's name.

    在原始窗口的.cs代码隐藏窗口中编辑,以便Window1成为新窗口的名称。

  4. Use the mouse on the drop-down after the new window name to copy the changed name elsewhere.

    在新窗口名称后面的下拉列表中使用鼠标将更改的名称复制到其他位置。

  5. Edit the title of the window.

    编辑窗口的标题。