Are URI Anchors exposed?

Mar 16, 2013 at 10:42 PM
In response to a question on reuse of links the suggestion is to add anchor values to the ends of the URIs, like this:
<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>
Are the values of those anchors available to the destination page?

In other words, does the anchor provide me with a way to pass a simple string value to the destination page?

In effect, I'd like to be able to set up something like this:
<mui:ModernWindow.MenuLinkGroups>
  <mui:LinkGroup DisplayName="Recipes">
    <mui:LinkGroup.Links>
      <mui:Link DisplayName="Beef Burgers" 
                Source="/Pages/RecipeDetails.xaml#Burgers" />
      <mui:Link DisplayName="Mexican Nachoes" 
                Source="/Pages/RecipeDetails.xaml#Nachoes" />
      <mui:Link DisplayName="Tomato Soup" 
                Source="/Pages/RecipeDetails.xaml#Soup"/>
    </mui:LinkGroup.Links>    
  </mui:LinkGroup>
</mui:ModernWindow.MenuLinkGroups>
If the RecipeDetails page knew the value of the passed anchor, it could be leveraged to find the appropriate details for display.
Coordinator
Mar 16, 2013 at 11:56 PM
Anchors are not directly exposed; I'm working on navigation improvements that includes support for fragment navigation.

As a workaround for now you can lookup the ModernFrame instance that is hosting the page and query its source property like so;
var frame = NavigationHelper.FindFrame(null, this);
if (frame != null) {
  var source = frame.Source;
}
Mar 17, 2013 at 6:23 AM
Thanks.