locked
Hyperlinks in multiple pages silverlight-blend 4 apps RRS feed

  • Question

  • Hi.. alicia's here..

    I am so new in this ms.blend 4.. and i think its wonderful IF i know how to use features in it.. One of my problems is that i can't do anything right in terms of HYPERLINKING.. or NAVIGATING.. 

    Say, I have 2 XAML pages in my project, and in page1, i have tried the Hyperlink Button, to navigate, but it's Failed.. Then i tried the normal button, added with HyperlinkAction behavior. Same result, it was failed. The browser keep showing : Error HTTP 404.

    This is my code for page1 (MainPage)

     


    <UserControl 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:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    	xmlns:pi="http://schemas.microsoft.com/prototyping/2010/interactivity"
    	x:Class="PencobaanHidup.MainPage"
    	Width="640" Height="480" mc:Ignorable="d">
    
    	<Grid x:Name="LayoutRoot" Background="White">
    		<TextBox x:Name="Username" Margin="223,171,210,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="34"/>
    		<PasswordBox x:Name="Password" Margin="223,226,210,220"/>
    		<Button x:Name="LoginButton" Content="Log In" Margin="0,0,210,161" Height="31" VerticalAlignment="Bottom" Foreground="Black" Background="#FF135B99" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Width="95"/>
    		<Button x:Name="RegisterButton" Content="Register" Margin="236,0,309,161" VerticalAlignment="Bottom" Height="31">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click">
    					<ei:HyperlinkAction/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Button>
    		<Button x:Name="ForgotPassButton" Content="Forgot Password" Margin="113,0,0,161" VerticalAlignment="Bottom" Height="31" HorizontalAlignment="Left" Width="119"/>
    		<TextBlock HorizontalAlignment="Left" Margin="156,175,0,0" TextWrapping="Wrap" Text="Username" VerticalAlignment="Top" Height="21" Width="63"/>
    		<TextBlock HorizontalAlignment="Left" Margin="160,226,0,233" TextWrapping="Wrap" Text="Password" Width="63"/>
    				<HyperlinkButton Content="HyperlinkButton" HorizontalAlignment="Left" Margin="147,59,0,0" VerticalAlignment="Top" NavigateUri="/PencobaanHidup;component/Tutorial.xaml"/>
    	</Grid>
    </UserControl>
    

     

     

    And this is my code for Page2

     

     

    <sdk:Page	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"
    	mc:Ignorable="d"
    	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"	x:Class="PencobaanHidup.Tutorial" 
    	Title="Tutorial Page"
    	d:DesignWidth="640" d:DesignHeight="480">
    	
    	<Grid x:Name="LayoutRoot" Background="White" >
    		<TextBlock HorizontalAlignment="Left" Margin="156,175,0,0" TextWrapping="Wrap" Text="Username" VerticalAlignment="Top" Height="21" Width="63"/>
    	</Grid>
    </sdk:Page>
    

    ------

     

    Please help me.. Im using Blend 4 and Silverlight 4.  Am i doing wrong. I know this is very basic.. Hyperlinking & Navigating. But im desperate to find out how. 

    Thank you so much :)

    Sunday, January 16, 2011 10:37 AM

Answers

  • Howdy

    Please review your scenarios here:

     

    http://msdn.microsoft.com/en-us/library/cc838245(v=VS.95).aspx

     

    You should be able to get this to work by choosing one of the solutions shown

    Cheers


    Expression MVP

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    • Marked as answer by Alicia_91 Monday, January 17, 2011 2:11 PM
    Monday, January 17, 2011 12:42 AM
    Moderator
  • Brennon's link to MSDN contains the answers you need. I believe one part of the problem is that your MainPage is a UserControl. The basics of navigating between pages is that you need a Frame element that displays Page elements. If your MainPage contained a Frame that displayed the content you currently have in MainPage as a separate page, the hyperlink should work to navigate to Page2.  Have a look at that MSDN page for more info and examples.
    • Marked as answer by Alicia_91 Monday, January 17, 2011 2:11 PM
    Monday, January 17, 2011 2:06 PM
    Moderator

All replies