Rob Relyea

xaml:Blog

Early notice of a change to WPF templates: "MyApp.xaml" to "App.xaml"

Just a quick note to book authors, users, and anybody else who cares.

I'm communicating early because...well, why wait?


Microsoft Tools and MyApp.xaml
The VS "Orcas" team and Expression Interactive Designer team plan to change a few things about the default files created when you create a new WPF project.  You'll likely see the change in VS next CTP...EID will come the release after that.

Today's Model
Today, VS "Orcas" creates a MyApp.xaml file with the following root element:
<Application x:Class="ProjectName.MyApp" ...>

Today, EID ("Sparkle") creates an Application.xaml file with the following root element:
<Application x:Class="ProjectName.MainApplication" ... >   

Next CTP's model
Those teams have decided to move to a consistent model.  The file will be called App.xaml and will look like this:
<Application x:Class="ProjectName.App" ... >
</Application>

 

What should you do?

Tool authors - you likely want to be consistent with this change.
Book authors - you probably want to update your examples.
Users - you can rename your files and x:Class attribute value if you like...although there is no need.

 

Manual steps to Change an existing project (if you want to)

To change your project in EID:

1) right click on Application.xaml, rename to App.xaml
2) right click on Application.xaml.cs or Application.xaml.vb, rename to App.xaml.cs or App.xaml.vb
3) in App.xaml, change x:Class="UntitledProject1.MainApplication" to x:Class="UntitledProject1.App"
4) if C# project, in App.xaml.cs:
    change from:
public partial class MainApplication: System.Windows.Application
   change to:
public partial class App: System.Windows.Application
5) if VB project, in App.xaml.vb:
    change from:
Partial Public Class MainApplication
    Inherits System.Windows.Application

   change to:

Partial Public Class App
    Inherits System.Windows.Application

 

To change your project in VS "Orcas":

1) right click on MyApp.xaml, rename to App.xaml
2) right click on Application.xaml.cs or Application.xaml.vb, rename to App.xaml.cs or App.xaml.vb
3) in App.xaml, change x:Class="ProjectName.MyApp" to x:Class="ProjectName.App"
4) if C# project, in App.xaml.cs:
    change from:
public partial class MyApp : Application

   change to:
public partial class App : Application

5) if VB project, in App.xaml.vb:
    change from:
Partial Public Class MyApp
    Inherits Application

   change to:

Partial Public Class App
    Inherits Application

Please let us know if you have questions/issues.

Posted on Apr 13 2006, 05:50 PM by rrelyea
Filed under:
PostTypeIcon
14,806 Views

Comments

    No Comments