簡體   English   中英

“ NavigationWindow”類型不支持直接內容

[英]The type 'NavigationWindow' does not support direct content

我正在嘗試使用NavigationWindow類而不是Window來允許WPF應用程序中的窗口之間進行導航。 但是在XAML中將內容添加到NavigationWindow時,出現錯誤:“類型'NavigationWindow'不支持直接內容”。 我怎樣才能克服這個問題?

您不能將任何內容添加到NavigationWindow。 頁面只是要在其中運行的“窗口”,因此您必須告知NavigationWindow夾心頁面它將要初次運行,您可以使用“源”來執行此操作,如下所示:

<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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM