tags:

views:

30

answers:

1

I have a bunch of reusable pages that I want to put into a class library. So I have edited my MainPage.xml ('Moe.Tactical.Generic.Silverlight' is the name of the class library)

<uriMapper:UriMapper>
  <uriMapper:UriMapping Uri="/Views/{path}" MappedUri="/Moe.Tactical.Generic.Silverlight;component/Views/{path}" />
  <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</uriMapper:UriMapper>

Then I assign the url in code, but I get the error: Page not found: "/Moe.Tactical.Generic.Silverlight;component/Views/GenericView?page=Maintanance"

I assign the Uri via

return new Uri(@"/" + pageType + "?page=" + page.Name, UriKind.Relative);

have I missed something?

+1  A: 

Sorry -- my first answer didn't apply. In your case, your mapping looks like this:

  <uriMapper:UriMapping Uri="/Views/{path}" MappedUri="/Moe.Tactical.Generic.Silverlight;component/Views/{path}" />

The Uri you've tried to navigate to doesn't match this pattern. You'll end up with something like: "/MyPageType?page=SomeName", which doesn't match "/Views/{path}". To make your Uri match the pattern, consider something like:

return new Uri(@"/Views/" + pageType + ".xaml?page=" + page.Name, UriKind.Relative); 

Note the extra "Views/" and ".xaml" in the Uri compared to the example you have in your question.

David.Poll
so now I get the uri: /Views/Moe.Tactical.Generic.Silverlight;component/Views/GenericView.xaml?page=Maintanance... still no dice
Grayson Mitchell
What are your mappings/navigation uris now? It looks like you've got an extra "/Views" in there at the beginning. It should just be "/Moe.Tactical.Generic.Silverlight;component/Views/GenericView.xaml?page=Maintenance" after mapping.
David.Poll
yea, that was from you comment above - "Note the extra Views/", however I have played around a bit, including removing that additional Views and I still can't navigate
Grayson Mitchell
Is the assembly containing the pages referenced by your application, or are you loading it dynamically (through MEF, Prism, or your own solution)? What is the error you're getting now?
David.Poll