Expression Blend 4 意外删除了 App.xaml

发布于 2024-09-20 00:28:00 字数 95 浏览 2 评论 0原文

我对 Expression 很陌生,不小心删除了 App.xaml 文件。我认为这是一个重要的文件,我无法研究如何创建等效文件。

请帮忙,

安迪

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.

Please help,

Andy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终遇你 2024-09-27 00:28:00

创建一个新项目并复制该项目。

<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>

除非您定义了应用程序资源,否则您可能会遇到麻烦。

可能是源代码控制的一个很好的论据。

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.

云仙小弟 2024-09-27 00:28:00

您可以创建一个新页面并将其命名为App.xaml

将其标记替换为 benPearce 所示:

<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>

将上面的“Test”替换为您的命名空间,将“Window1”替换为您想要在项目中显示的第一页的名称。

将 App.xaml.cs 代码隐藏中的类替换为:

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

确保在“应用程序”区域中设置项目属性,以便启动对象为 YourNamespace.App

执行构建,您应该不会再收到与“App”相关的错误。

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'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文