The type 'NavigationWindow' does not support direct content
I am trying to use NavigationWindow class instead of Window to allow navigation开发者_如何学C 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?
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
精彩评论