类型“NavigationWindow”;不支持直接内容

发布于 2024-12-07 01:25:33 字数 152 浏览 2 评论 0原文

我正在尝试使用 NavigationWindow 类而不是 Window 来允许 WPF 应用程序中的窗口之间进行导航。但是,当在 XAML 中向 NavigationWindow 添加内容时,出现错误: “‘NavigationWindow’类型不支持直接内容”。我怎样才能克服这个问题?

I am trying to use NavigationWindow class instead of Window to allow navigation between windows in WPF application. But when adding content to the NavigationWindow in XAML, I am getting an error:
"The type 'NavigationWindow' does not support direct content". How can I overcome this problem?

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

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

发布评论

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

评论(1

不及他 2024-12-14 01:25:33

您无法向导航窗口添加任何内容。
它只是页面将要运行的“窗口”,因此您必须告诉页面将要初始运行的导航窗口,您可以通过使用“Source”来做到这一点
像这样:

<NavigationWindow x:Class="Tes.TesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Test" Height="300" Width="300" Source="Window1.xaml">
</NavigationWindow>

请参阅此处的教程:
http://windowsclient.net/learn/video.aspx?v=4190

You can't add any content to a NavigationWindow.
It is just a "Window" where the Page is going to run, so you have to tell the NavigationWindow wich Page it is going to initial run, you do that by using "Source"
Like this:

<NavigationWindow x:Class="Tes.TesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Test" Height="300" Width="300" Source="Window1.xaml">
</NavigationWindow>

See a tutorial here:
http://windowsclient.net/learn/video.aspx?v=4190

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