Simple XAML to XAML page navigation
I am trying to simply navigate from one .xaml page to another. I realize that the navigation template is built for this but I do not want the mainpage header / content below feel that it brings. Using a blank Silverlight application (C#) I want to move from Page1.xaml to Page2.xaml using a hyperlink button.
On Page1.xaml I have a hyperlink button like this:
<HyperlinkButton Content="Preview Report" Height="24" HorizontalAlignment="Stretch" Margin="98,296,377,21" Name="h开发者_JAVA技巧yperlinkButton1" NavigateUri="/Page2.xaml" />
this doesn't seem to work. Please help
You will need a navigation frame in your MainPage in order to support this. Start with blank Silverlight Application.
Modify MainPage.xaml to look like:-
<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>
Add two or more Navigation Page's to your project. Now you can add HyperLinkButton
elements to them.
精彩评论