C# 简单的XAML到XAML页面导航

C# 简单的XAML到XAML页面导航,c#,silverlight,xaml,silverlight-4.0,C#,Silverlight,Xaml,Silverlight 4.0,我试图简单地从一个.xaml页面导航到另一个。我意识到导航模板是为此而构建的,但我不想让下面的主页头/内容感觉到它带来了什么。使用空白的Silverlight应用程序C,我想使用超链接按钮从Page1.xaml移动到Page2.xaml 在Page1.xaml上,我有一个超链接按钮,如下所示: <HyperlinkButton Content="Preview Report" Height="24" HorizontalAlignment="Stretch" Margin="98,296,

我试图简单地从一个.xaml页面导航到另一个。我意识到导航模板是为此而构建的,但我不想让下面的主页头/内容感觉到它带来了什么。使用空白的Silverlight应用程序C,我想使用超链接按钮从Page1.xaml移动到Page2.xaml

在Page1.xaml上,我有一个超链接按钮,如下所示:

<HyperlinkButton Content="Preview Report" Height="24" HorizontalAlignment="Stretch" Margin="98,296,377,21" Name="hyperlinkButton1" NavigateUri="/Page2.xaml" />

这似乎不起作用。请提供帮助

您需要在主页中安装导航框以支持此功能。从空白的Silverlight应用程序开始

将MainPage.xaml修改为:-

<UserControl x:Class="StackoverflowSpikes.NavPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"              
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <navigation:Frame Source="/Page1.xaml" />
    </Grid>
</UserControl>
向项目中添加两个或多个导航页面。现在,您可以向它们添加HyperLinkButton元素