开发者

Expression Blend 4 accidently deleted App.xaml

开发者 https://www.devze.com 2023-01-16 17:41 出处:网络
Im new to Expression and by accident I deleted the App.xaml file. I think this is an important file and I cannot workout how to create an equivalent.

Im new to Expression and by accident I deleted the App.xaml file. I think this is an important file and I cannot workout how to create an equivalent.

Pl开发者_如何转开发ease help,

Andy


Create a new project and copy that one.

<Application x:Class="Test.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>

    </Application.Resources>
</Application>

Unless you had Application Resources defined, then you may be in trouble.

Might be a good argument for Source Control.


You can create a new Page and call it App.xaml.

Replace its markup as benPearce indicated with this:

<Application x:Class="Test.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>

    </Application.Resources>
</Application>

Replace "Test" above with your namespace and "Window1" with the name of the first page you want shown in your project.

Replace the class in the App.xaml.cs code-behind with this:

public partial class App : Application
{
    [STAThread]
    public static void Main()
    {
        YourNamespace.App app = new YourNamespace.App();
        app.InitializeComponent();
        app.Run();
    }
}

Ensure that your Project Properties are set in the "Application" area such that your startup object is YourNamespace.App.

Perform a build and you shouldn't get anymore errors related to 'App'.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号