我正在尝试简单地从一个.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" />这似乎不管用。请帮帮忙
发布于 2010-12-13 03:04:49
你需要在你的MainPage中有一个导航框架来支持这一点。从空白的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元素。
https://stackoverflow.com/questions/4419196
复制相似问题