iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello everybody,
how should I foward a NavigationParameter to the child view models of a tabbed page?
Kind regards,
Fabian
public class TabViewModel : MultiPageViewModelBase{ public TabViewModel() { var parameter1 = "Simple Page"; var parameter2 = "About Page"; var items = new List<NavigationItem>(); items.Add(new NavigationItem("Simple Page", new NavigationTarget(typeof(SimpleViewModel), new NavigationParameter(parameter1)))); items.Add(new NavigationItem("About", new NavigationTarget(typeof(AboutNavigationViewModel), new NavigationParameter(parameter2)))); this.Items = items.ToArray(); }}
2. The second technique is the dynamic one. You can perform any logic based on your scenario to provide the parameter and pass it to the child's view model. Simply, you only need to override the ShouldNavigate method from the parent's view model. See the following code.
public class TabViewModel : MultiPageViewModelBase { public override bool ShouldNavigate(NavigationTarget target) { // Perform your own logic here if (target.Type == typeof(SimpleViewModel)) target.Parameter.Data = this.Data1; else target.Parameter.Data = this.Data2; return base.ShouldNavigate(target); } }
Hope this helps. Feel free to discuss it further if you have any other thought.
Kind Regards,
Jack
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname