Links to the same URI

Mar 14, 2013 at 8:46 PM
I am trying to create an application that uses the MenuLinkGroups as "Workspaces", and will be dynamic based on a view model. each workspace will have 3 standard links, all of which will be content driven based on which workspace they were in when clicking that link.

I'm having an issue currently getting this to work, as I believe the navigation is getting confused. For example. I'm at workspace 1 / link 1 when application launches. If i click on link 2 and then click on workspace 2 or 3, it takes me back to workspace 1/ link 1.

Hopefully you can shed some insight on my issue. Please let me know if I can provide any more information.
Coordinator
Mar 14, 2013 at 11:53 PM
You need to specify unique link sources. If two or more links have the same Source value, the menu automatically selects the first one it finds.

You can create links that refer to the same page by adding an anchor to the uri. The following menu links reference the same Page1.xaml, but have a unqiue Source:
<mui:ModernWindow.MenuLinkGroups>
  <mui:LinkGroup DisplayName="Group 1">
    <mui:LinkGroup.Links>
      <mui:Link DisplayName="Link 1" Source="/Pages/Page1.xaml#1" />
      <mui:Link DisplayName="Link 2" Source="/Pages/Page1.xaml#2" />
      <mui:Link DisplayName="Link 3" Source="/Pages/Page1.xaml#3"/>
    </mui:LinkGroup.Links>    
  </mui:LinkGroup>
</mui:ModernWindow.MenuLinkGroups>
Mar 15, 2013 at 4:46 AM
PERFECT. That is exactly what I was looking for. I will test this out tomorrow. Thank you very much for your help.
Coordinator
Mar 16, 2013 at 11:53 PM
There's one issue with this approach though; a new instance of Page1.xaml will be created for each link. That's probably not what you want. I'm currently busy improving the navigation stack to overcome this limitation.
Apr 2, 2013 at 5:41 AM
Might be a beginner question, but can you post an example of what the receiving Page.1xaml should look like to differentiate between sections? I created a new basic page for "Page1.xaml" but I'm trying to figure out how to set the entry points on the receiving page to handle these anchors. Thanks.
Coordinator
Apr 2, 2013 at 7:37 AM
You'll need to implement the IContent interface in the Page1.xaml.cs. Then handle the OnFragmentNavigation method to handle the fragment. See also this post