开发者

The type 'NavigationWindow' does not support direct content

开发者 https://www.devze.com 2023-04-09 00:58 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消