Add hyperlinks to popup menu control, add to MainPage

Feb 1, 2011 at 8:26 PM

Thank you so much for sharing your time and work! Your control was the only one I could find for Silverlight 4, it works very well and does exactly what I want - up to the point where my lack of skill has stopped me.

I created the menu (based on demo2-hover all-xaml code) as a separate control, The nested menus display correctly but don't navigate anywhere yet.  I want to use this control on my base MainPage and programmatically control when it is available as a menu. On the MainPage I have just this to insert the control.  (I also have a Navigation Frame with its UriMapper on the MainPage) :

      <Grid x:Name="WinMenu" Height="48" Width="1024"VerticalAlignment="Top" ><local:WinMenu/></Grid>

The menus open and close just fine so far, but like the Demo, don't navigate anywhere yet. You had one hyperlink to an external page. It looked like standard syntax so on the WinMenu control I tried to take one menu item 

     <my:PopupMenuItem Name="RS1" Header="Categories" />

and replace that line with :

     <HyperlinkButton Name="RS1" Content="Categories" NavigateUri="/Views/RS1.xaml" />

The item now shows correctly in the dropdown list when I run the app - until I click on that hyperlink item. Then I get this error message:

"The resource cannot be found." Description: HTTP 404. Requested URL: /Views/RS1.xaml. Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

 As a first-timer I can't figure out the syntax for turning the lowest level MenuItem into a hyperlink if this is wrong (used to access local pages only).  I am also confused about the architecture - do the hyperlink URIs/uriMapper get listed on the WinMenu control xaml page or the MainPage control xaml page or both places? It is clearly not able to resolve the URL between the Menu control and main pages.

Must I put the xaml for this control on the MainPage for it to work with the Navigation Frame there? I am concerned that since less than half the pages need this menu to access them, download times will be impacted. I think that if the menu remains a separate control, I can use the MEF framework to control its download.