简体   繁体   中英

How do I get a custom application name and starting window name in Visual C# 2008 using WPF?

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.

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.

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?

Follow these steps:

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

  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:

    StartupUri="Window1.xaml"

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

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM