Oct 27, 2010 at 11:17 PM
Edited Oct 27, 2010 at 11:18 PM

I know you publish a message so that a new view will be loaded

EventAggregator.Publish(new ViewNavigationArgs("MyView")); 

My thought is that a lot of people use the Frame control and the features that tie in with it (url mapping, accessing url fragments/querystring etc).  What about implementing a INavigationContentLoader that overrides the default Frame behavior and then allows you to handle view navigation and dynamic xap view loading yet still provided common functionality that people use with the Frame control?


Oct 28, 2010 at 1:14 AM

This is definitely something I'll show in future blog posts (actually, my next one after region management will have to take this on) but it's not something I want to put in the core framework - perhaps as an optional assembly like region management. Why?

Several reasons:

First, I treat Silverlight applications as applications, not as rich web pages. The navigation framework tries to treat them as web pages even though the so-called SEO doesn't really produce anything readable by search engines. It's just a way to have URLs that route to views and I can easily do that by processing the query string or URL in my Silverlight app irregardless of a framework.

Second, I believe that things like query string are just an attempt to bridge the gap between a way of thinking from traditional web/ASP.NET development to Silverlight. With Silverlight, there are certainly far better ways to pass information between views - the querystring is nice and easy because it's what HTML devs are used to, but I personally don't want to treat my Silverlight application like a glorified web app. I'd rather simply persist the values and communicate between view models than have some hack that looks good in the URL bar but really doesn't serve other purposes.

I also know a lot of examples and code is out there using it - hence why I will show some guidance to integrate it - but most of the enterprise and line of business applications I've worked with don't use that, and instead use other more natural means of navigation. I'm not sure it is truly as pervasive as people think it is - I think the perception is there, but in working with a lot of different companies, I think most get it and don't use the framework for any number of reasons.

Those are just my thoughts - again, I will address it and have an example of integration - but not something I really want to promote or push because I believe it's the wrong way and haven't found a compelling reason to believe there is true value added by the navigation framework that's built in.

Oct 28, 2010 at 3:54 PM

Definitely understand what your saying.  From my perpective I don't use querystrings etc to get from view to view once i'm in the application, like you said, there are lots of other ways to pass data between views.  Where I use the nice url's and querystring is for external applications / users to be able to go directly to a page and have that page load default data etc based off of the url and querystring that is coming in from some other external "source".

For example an eternal application can link to my app by providing a url to take them directly where they need to go.

http://myApp/#Search/Grid/ModuleA?policyNum=###### (Load ModuleA grid view with Policy Number ######)

http://myApp/#Search/Folder/ModuleA?claimNum=######/##/####/####/### (Load ModuleA folder view with Claim Number ######/##/####/####/###)

With the url mappings defined I then know which area of my application and which view the users wants to go to and load some default data automatically.

Do you have an approach to accomplishing the same type of scenario without using the Frame Control and url mapping/querystring?

Oct 28, 2010 at 4:11 PM

Sure. Will include that in my series.

Oct 28, 2010 at 4:49 PM

great, look forward to your post!!