<n:NavigateIfTrueAction ManageEnableState="True" Command="{Binding CheckSomethingFunction}" Url="/Pages/NextStep" />
if true is returned we follow the url, otherwise no navigation is performed. The developer may show some error message or whatever to inform the user about the reason of canceling the navigation request.
The definition of the navigation target is still not hard coded, but we can trigger some function do do something programmatically.
With best regards
Gerhard
I personally don’t shy away from navigating from view-models, especially when there some logic involved (like checking some non-trivial stuff, as you said). In the end, navigation is still a service, and view-models use services, so I don’t really see the problem.
Also, when navigation parameters need to be built up using some non-trivial logic, I also navigate from code.
Finally, much as I like xaml, blend 4 is useless on non-hello-world level projects (always crashes, throws, doesn’t load designer etc) so then I guess I’d make my life more difficult using xaml-only navigation J
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Hmm...i’m not sure I get what you’re saying: why is wp7 navigation different than desktop/Silverlight? Using nRoute it should be exactly the same. Or am I missing something?
Adi
But wait, if it takes two screens, don’t you have then two VMs? Or you reuse just one, in which case it would have to anyway implement some logic for parsing parameters passed between the pages, which otherwise (in the one-screen-view) wouldn’t have been passed? Which means you still have some different logic depending on the application context?
So I’m not sure this otherwise ideal separation is easily achievable. As to navigation, I have a wrapper over the navigation service with named methods such as “NavigateToFeature” or “NavigateToMenuItem” or “NavigateShellTo”, which themselves decide where exactly to navigate depending on the application context (Silverlight or wp7), so all those #ifs are in one place and view models remain “clean” J
Cheers,
Adi
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Well, if you want to have the same instance of a VM between screens, there is a discussion on codeplex about that. I’m not sure it’s a good idea myself, that’s why I was thinking that I’d rather pass some parameters (or just one, the data) to the same *type* of VM, but a different *instance*. But again, if you do that, you won’t have context independence.
In the end we each should use I guess whatever works for us, for me it’s ok that the VM depends on a NavigationService ;)
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
From: nro...@googlegroups.com [mailto:nro...@googlegroups.com] On Behalf Of Gerhard Kreuzer
Sent: Wednesday, March 02, 2011 1:58 PM
To: nro...@googlegroups.com
The discussion is here: http://nroute.codeplex.com/discussions/213732
As for the controller for a wizard, why don’t you use a service for that?
Cheers,
Adi
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Well, I guess the vms would be in charge of the UI state for a particular view and the controller would deal with the “global” state.