﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - Forward NavigationParameter to child views</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Forward-NavigationParameter-to-child-views/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Forward NavigationParameter to child views</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Forward-NavigationParameter-to-child-views/</link><pubDate>Wed, 26 Mar 2014 22:15:44 GMT</pubDate><dc:creator>Jack</dc:creator><description>&lt;br /&gt;Hi Fabian.&lt;br /&gt;&lt;br /&gt;You can pass any parameter to child view models from a tabbed page in 2 ways.&lt;br /&gt;&lt;br /&gt;1. You can pass the parameter while initializing the tab items. You can specify it from the constructor of the parent's view model. See the following code.&lt;br /&gt;&lt;pre&gt;public class TabViewModel : MultiPageViewModelBase{
        public TabViewModel()
        {
            var parameter1 = "Simple Page";
            var parameter2 = "About Page";
            var items = new List&amp;lt;NavigationItem&amp;gt;();
            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();
        }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;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.&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;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);
        }
}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Hope this helps. Feel free to discuss it further if you have any other thought.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Jack&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Forward NavigationParameter to child views</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Forward-NavigationParameter-to-child-views/</link><pubDate>Tue, 25 Mar 2014 14:15:41 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;Hello everybody,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;how should I foward a NavigationParameter to the child view models of a tabbed page?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Fabian&lt;/p&gt;</description></item></channel></rss>