This project is read-only.

Hyperlink Navigation

Jun 9, 2010 at 6:44 AM
Edited Jun 9, 2010 at 6:48 AM

I've put nRoute into the Silverlight Business Appilcation, and when I replace the SilverSlight navigation with this:

<Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}">

<n:NavigationContainer x:Name="ContentFrame" Grid.Row="1" Url="Views/ShiftView" >

<n:NavigationHandlerBehavior IsDefaultHandler="True" />

<n:NavigationShellIntegrationBehavior />


The hyperlinkbuttons such as this:

<HyperlinkButton x:Name="Link1" Style="{StaticResource LinkStyle}" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"> </HyperlinkButton>

cause a new browser window to appear rather than making the Navigation Container change. Any suggestions?

Jun 9, 2010 at 8:53 AM

The answer is very simple, you need to use nRoute's built-in behaviors to induce navigation. Basically just drag-drop the "NavigateAction" behavior then set the url and handler name as required. You'll get something like:

<HyperlinkButton x:Name="Link1" Style="{StaticResource LinkStyle}" Content="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"> 
		<i:EventTrigger EventName="Click">
    		       <n:NavigateAction Url="Content/SomePage" HandlerName="ContentFrame"/>

Now the reason why it was opening a new page was that the hyperlink button's properties such as TargetName and NavigateUri when not used with Silverlight's own navigation framework target the browser/html infrastructure - which is to say they can navigate to a normal url or specifically navigate in a named window. 

Hope this helps,

Jun 9, 2010 at 3:30 PM
Hi Thanks for that - it works great now. I was looking at some older posts that had a slightly different trigger on them