【发布时间】:2017-02-12 12:38:21
【问题描述】:
我做了最简单的事情。我打开一个新窗口并在其中放置一个框架,我想在框架中显示一个页面。 窗口代码:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Page1 p = new Page1();
navigator.NavigationService.Navigate(p);
}
}
navigator 是框架,在 Page1 我有黑色背景颜色来查看差异。当我运行它时,我仍然看到窗口,而不是应该在框架内的页面。为什么这不起作用?
但我买的是白色的。
第 1 页的代码:
<Page x:Class="test.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="269" d:DesignWidth="292"
Title="Page1">
<Grid Background="Black">
</Grid>
在cs方面我什么都没写。
【问题讨论】:
-
page1 的代码是什么?
-
我将其添加到问题中。
标签: c# wpf navigation