创建一个新班级是不够的。您需要正确设置一对xaml和xaml.cs文件才能一起工作。创建一个名为App的新窗口。这会给你的文件。然后修改他们两个打开的窗口到应用程序:
App.xaml中需要看起来像这样:
<Application x:Class="WpfApplication3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
当然WpfApplication3必须用自己的应用程序的名称所取代。
然后让App.xaml.cs这个样子,也改变WpfApplication3:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace WpfApplication3
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
最后更改属性为App.xaml中,使生成操作读ApplicationDefinition。
这应该做到这一点。
来源
2016-01-04 16:20:05
Tim
_“我不小心删除了...”_下次使用源代码管理。 – CodeCaster 2014-08-31 17:52:39