﻿<?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 - ClientUI - How to pass an object to a page</title><link>http://www.intersoftsolutions.com/Community/ClientUI/How-to-pass-an-object-to-a-page/</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>How to pass an object to a page</title><link>http://www.intersoftsolutions.com/Community/ClientUI/How-to-pass-an-object-to-a-page/</link><pubDate>Tue, 16 Oct 2012 07:46:51 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Please ignore my previous post and try to do the following.
&lt;/span&gt;&lt;/p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;&lt;ol style="color: rgb(31, 73, 125);"&gt;
&lt;li&gt;Open NavigationServiceProvider.cs and add a function which receives three parameters: Uri; Boolean; and object. The class should look like following after modification.&lt;br&gt;&lt;/br&gt;&lt;pre&gt;using System;
using System.Windows;
using Intersoft.Client.Framework;
using Intersoft.Client.Framework.Input;
namespace NavigateToPageUsingCommand.ViewModels
{
    public class NavigationServiceProvider
    {
        public static void Navigate(Uri uri)
        {
            NavigationCommands.Navigate.Execute(uri, (UIElement)ISFocusManager.GetFocusedElement());
        }
        public static void Navigate(Uri uri, bool hasExtraData, object extraData)
        {
            NavigationOptions options = new NavigationOptions(uri)
            {
                ExtraData = extraData
            };
            NavigationCommands.Navigate.Execute(options, (UIElement)ISFocusManager.GetFocusedElement());
        }
        public static void Navigate(Uri uri, object targetElement)
        {
            NavigationCommands.Navigate.Execute(uri, (UIElement)targetElement);
        }
    }
}&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Find the command which is used to navigate and modify it into:&lt;br&gt;&lt;/br&gt;&lt;pre&gt;NavigationServiceProvider.Navigate(new Uri("/BookJob", UriKind.RelativeOrAbsolute), true, Object.BookJob)&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;In BookJob.xaml file, bind NavigatedCommand property to NavigatedCommand.&lt;br&gt;&lt;/br&gt;&lt;pre&gt;&amp;lt;Intersoft:UXPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="clr-namespace:NavigateToPageUsingCommand.ViewModels"
	mc:Ignorable="d"
	xmlns:Intersoft="http://intersoft.clientui.com/schemas"
	x:Class="NavigateToPageUsingCommand.Views.EditContactProfile" 
	Title="EditContactProfile Page"
	d:DesignWidth="640" d:DesignHeight="480"
    NavigatedCommand="{Binding NavigatedCommand}"&amp;gt;
    
    &amp;lt;Intersoft:UXPage.DataContext&amp;gt;
        &amp;lt;ViewModels:EditBookJobViewModel/&amp;gt;
    &amp;lt;/Intersoft:UXPage.DataContext&amp;gt;
    &amp;lt;Grid x:Name="LayoutRoot"&amp;gt;
	&amp;lt;/Grid&amp;gt;
&amp;lt;/Intersoft:UXPage&amp;gt;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Open the view model of BookJob and obtain the object (which is passed as parameter) in OnNavigatedCommand by using following expression: ((Intersoft.Client.UI.Navigation.NavigatedCommandParameter)(parameter)).ExtraData.&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;</description></item><item><title>How to pass an object to a page</title><link>http://www.intersoftsolutions.com/Community/ClientUI/How-to-pass-an-object-to-a-page/</link><pubDate>Fri, 12 Oct 2012 06:15:47 GMT</pubDate><dc:creator>zen8019</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;&lt;p&gt;I  have added binded &lt;span style="background-color: rgb(255, 255, 255); color: rgb(31, 73, 125); font-family: 'lucida grande', 'segoe ui', arial, verdana, tahoma; font-size: 12px; line-height: 18px; "&gt;NavigatedCommand&lt;/span&gt;&lt;span style="background-color: rgb(255, 255, 255); color: rgb(31, 73, 125); font-family: 'lucida grande', 'segoe ui', arial, verdana, tahoma; font-size: 12px; line-height: 18px; "&gt;&amp;nbsp; to my command in my ViewModel. &amp;nbsp;The code goes through that command - what I don't know what to do is retrieve the passed (querystring) parameter (business object).&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre style="font-family: consolas; background-color: white; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; "&gt;&amp;nbsp;&lt;span style="font-family: 'lucida grande', 'segoe ui', arial, verdana, tahoma; color: blue; "&gt;string&lt;/span&gt;&amp;nbsp;id&amp;nbsp;=&amp;nbsp;&lt;span style="font-family: 'lucida grande', 'segoe ui', arial, verdana, tahoma; color: blue; "&gt;this&lt;/span&gt;.NavigationContext.QueryString[&lt;span style="font-family: 'lucida grande', 'segoe ui', arial, verdana, tahoma; color: rgb(163, 21, 21); "&gt;"ID"&lt;/span&gt;]; works fine for string types &lt;/pre&gt;&lt;pre style="font-family: consolas; background-color: white; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; "&gt;How do I get the business class object?&lt;/pre&gt;&lt;pre style="font-family: consolas; background-color: white; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; "&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="font-family: consolas; background-color: white; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; color: rgb(63, 63, 63); line-height: 18px; "&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p /&gt;</description></item><item><title>How to pass an object to a page</title><link>http://www.intersoftsolutions.com/Community/ClientUI/How-to-pass-an-object-to-a-page/</link><pubDate>Fri, 12 Oct 2012 05:38:12 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;UXPage has NavigatedCommand property. It gets or sets the command to execute when the UXFrame navigates to this page.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;You may try to utilize this property for your scenario. First, create a delegate command and set the DataContext for the intended page in this command. Next, we can bind the command for the NavigatedCommand property of the page.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Hope this help.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass an object to a page</title><link>http://www.intersoftsolutions.com/Community/ClientUI/How-to-pass-an-object-to-a-page/</link><pubDate>Thu, 11 Oct 2012 15:58:47 GMT</pubDate><dc:creator>zen8019</dc:creator><description>&lt;p&gt;How can I navigate to a page passing a class business object to it as parameter - using MVVM.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;E.g.  &lt;span style="font-family: consolas; color: rgb(43, 145, 175); "&gt;NavigationServiceProvider&lt;/span&gt;&lt;span style="background-color: white; font-family: consolas; "&gt;.Navigate(&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; "&gt;new&lt;/span&gt;&lt;span style="background-color: white; font-family: consolas; "&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: consolas; color: rgb(43, 145, 175); "&gt;Uri&lt;/span&gt;&lt;span style="background-color: white; font-family: consolas; "&gt;(&lt;/span&gt;&lt;span style="font-family: consolas; color: blue; "&gt;string&lt;/span&gt;&lt;span style="background-color: white; font-family: consolas; "&gt;.Format(&lt;/span&gt;&lt;span style="font-family: consolas; color: rgb(163, 21, 21); "&gt;"/BookJob/{0}"&lt;/span&gt;&lt;span style="background-color: white; font-family: consolas; "&gt;,&amp;nbsp;e.Object.BookJob),&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: consolas; color: rgb(43, 145, 175); "&gt;UriKind&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;.Relative));&lt;/pre&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;Where 'BookJob' is an class Object .  I get a fail here because NavigationContext only has string.&lt;/pre&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;&lt;span style="color: green; "&gt;// Executes when the user navigates to this page.&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; "&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; "&gt;void&lt;/span&gt;&amp;nbsp;OnNavigatedTo(&lt;span style="color: rgb(43, 145, 175); "&gt;NavigationEventArgs&lt;/span&gt;&amp;nbsp;e)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;if&lt;/span&gt;&amp;nbsp;(&lt;span style="color: blue; "&gt;this&lt;/span&gt;.NavigationContext.QueryString.Count&amp;nbsp;&amp;gt;&amp;nbsp;0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;string&lt;/span&gt;&amp;nbsp;id&amp;nbsp;=&amp;nbsp;&lt;span style="color: blue; "&gt;this&lt;/span&gt;.NavigationContext.QueryString[&lt;span style="color: rgb(163, 21, 21); "&gt;"ID"&lt;/span&gt;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;if&lt;/span&gt;&amp;nbsp;(!&lt;span style="color: blue; "&gt;string&lt;/span&gt;.IsNullOrEmpty(id))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;this&lt;/span&gt;.DataContext&amp;nbsp;=&amp;nbsp;&lt;span style="color: blue; "&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style="color: rgb(43, 145, 175); "&gt;BookJobViewModel&lt;/span&gt;(&lt;span style="color: blue; "&gt;int&lt;/span&gt;.Parse(id));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue; "&gt;return&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;Is there another way achieve this/&lt;/pre&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white; "&gt;&lt;br /&gt;&lt;/pre&gt;</description></item></channel></rss>