Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
164 views
in Technique[技术] by (71.8m points)

windows phone 7 - Passing data from page to page

I'm looking for the best practice on how to pass data from page to page.

In Page A I have a button that fires off Page B.
On Page B I have 6 textboxes that allow the user to enter information. When the user is done, the click on a button that brings them back to Page A.

I want to pass that data back to Page A.

I've seen suggestions to:

  • build XML documents and save to Isolated Storage
  • use the App class to store information in properties
  • pass it like a query string

I'm looking for the Best practice. Is there one that Microsoft recommends or one that is generally accepted as the best way?

Thanks

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

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

then in other page simply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...