×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    36

    Question How to pass objects from one page to another in widows phone 8

    sorry, I just found the solution, let me know is this a good way to pass objects among pages.

    PhoneApplicationService.Current.State["yourparam"] = param
    NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));

    and get on other page like this
    var k = PhoneApplicationService.Current.State["yourparam"];

    I got from search.

    Thanks
    Last edited by sunder.tinwar; 2013-06-03 at 10:46.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: How to pass objects from one page to another in widows phone 8

    The examples at lumia library: http://www.developer.nokia.com/Resou...a/#!index.html generally have made a singleton class which holds data which needs to be accessed by multiple screen.

    Maybe you could try same, if I remember right at least the Camera example has it.

    Also you could also simply store the object in your Application class, and access it from any page.

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    36

    Re: How to pass objects from one page to another in widows phone 8

    Sorry got the solution, let me know is it good way to pass objects or not.

    PhoneApplicationService.Current.State["yourparam"] = param
    NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));

    and on other page we can get it like this.

    var k = PhoneApplicationService.Current.State["yourparam"];

    further we can convert it and use it.

    Thanks

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    574

    Re: How to pass objects from one page to another in widows phone 8

    Quote Originally Posted by sunder.tinwar View Post

    PhoneApplicationService.Current.State["yourparam"] = param
    NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));

    and on other page we can get it like this.

    var k = PhoneApplicationService.Current.State["yourparam"];
    That's a perfectly good way to do it. Another benefit is that the 'global' state dictionary will survive suspend/tombstoning.

  5. #5
    Registered User
    Join Date
    May 2013
    Posts
    1

    Re: How to pass objects from one page to another in widows phone 8

    You can also pass parameters in your navigate code, similar to how you navigate in html

    NavigationService.Navigate(new Uri("/view/Page.xaml?yourparam=" & param, UriKind.Relative));

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    574

    Re: How to pass objects from one page to another in widows phone 8

    Quote Originally Posted by I Jones View Post
    NavigationService.Navigate(new Uri("/view/Page.xaml?yourparam=" & param, UriKind.Relative));
    Although that's valid, you're limited to key/value pairs - and it's not possible to pass objects that way.

  7. #7
    Registered User
    Join Date
    Jun 2013
    Posts
    19

    Re: How to pass objects from one page to another in widows phone 8

    you can use public class to store objects and object sharing concept could be used to share objects among different pages.

Similar Threads

  1. Replies: 6
    Last Post: 2012-02-29, 10:43
  2. Replies: 0
    Last Post: 2005-09-09, 10:56
  3. Replies: 0
    Last Post: 2005-02-17, 06:15
  4. Why I can't pass the variable in JSP to next page?
    By msc73jxs in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2002-08-31, 14:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×