views:

363

answers:

3

I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually using the Silverlight navigation system, a Page. Following Nikhil's example, my View should derive from the Silverlight.FX Window class.

What's the best approach to making a Window that also supports the Page functionality or is there something that already does this?

+1  A: 

Discovered the Page and PageFrame classes of Silverlight.FX. These classes have the same basic functionality as the Silverlight navigation types but with support for the binding I was looking for.

xmlns:fxnav="clr-namespace:SilverlightFX.UserInterface.Navigation;assembly=SilverlightFX"
...
<fxnav:PageFrame x:Name="_frame"
                 IsIntegratedWithBrowser="True"
                 DefaultUri="StartView"
                 HorizontalContentAlignment="Stretch"/>

I'm having trouble grabbing the parent container from the Pages' code-behind (unlike the Silverlight 3.0 Page) but I shouldn't need it once I remove the Click handler and fully switch to MVVM anyway.

Nick Gotch
Indeed, ideally the individual pages don't reach out into the parent view that contains the PageFrame, as this introduces less than ideal coupling.
NikhilK
A: 

It is worth to mention that PageFrame's default PageLoader component automatically mapping all pages available. There is no way to use new UriMapping component from Silverlight 3 with SilverlightFX's PageFrame. So, if your page is named as MySilverlightPage.xaml (and corresponding page class has the same name), it will be available at "mysilverlight" address.

P.S. I decided to mention it, because it was not clear for me when I tried to use SilverlightFX first time.

Safor
A good tip, thanks!
Nick Gotch
A: 

Within MVVM model, how can i navigate using silverlightFX?

Model can't access View's resources. So i made an event, which the View subscribes upon. But in the View code behind, i want to navigate to the desired uri.

What is the best approach?

Atam

related questions