Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 685615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:56:25+00:00 2026-05-14T01:56:25+00:00

I have a Page in Silverlight which is Navigated from the MainPage.xaml, called OpenPage.xaml,

  • 0

I have a Page in Silverlight which is Navigated from the MainPage.xaml, called OpenPage.xaml, I then want to pass a value back to the MainPage.xaml – this OpenPage.xaml is called using this:

NavigationService.Navigate(new Uri("/OpenPage.xaml", UriKind.Relative));

From the mainpage – this is not a child of the MainPage as the RootVisual is replaced – I can call this:

NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

To return to the MainPage – however I need to pass a value from OpenPage.xaml to the MainPage.xaml – how to I access the MainPage instance – I have a Property called Document however when I do this:

        MainPage m = (MainPage)Application.Current.RootVisual;
        m.Document = "Hello World";

Or this:

((MainPage)root).Document = "Hello World";

I get an invalid cast exception because I think it is trying to cast the OpenPage.xaml to MainPage.xaml – how to I get the NavigatedTo Page, I want to set the property on MainPage.xaml from OpenPage.xaml.
I also want to pass values from the MainPage.xaml to another page SavePage.xaml – but this has the same issue – how do I resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:56:26+00:00Added an answer on May 14, 2026 at 1:56 am

    Use a query string value:-

    NavigationService.Navigate(new Uri("/MainPage.xaml?value=Hello%20World", UriKind.Relative);
    

    MainPage can then acquire this value using:-

    string value =  this.NavigationContext.QueryString["value"];
    

    Edit:

    In response to comment re passing other types.

    Once you have the above inplace you can use other service patterns to pass other types. For example consider a MessageService that implements:-

    interface IMessageService
    {
        Guid Store(object value)
        object Retrieve(Guid key)
    }
    

    You would then implement this interface and expose the implementation as singleton say:-

    public class MessageService : IMessageService
    {
        public static IMessageService Default { // singleton stuff here }
    }
    

    Your OpenPage calls MessageService.Default.Store and places the resulting Guid in the query string.

    The MainPage then tests for the presence of such a query string value, if present uses its value to call MessageService.Default.Retrieve which removes the item from the service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have page which is redirected from htaccess. now I can pass the German
I have a problem posting the data from silverlight to the aspx page which
I have a xaml navigation page with 5 listboxes (Silverlight 3). Four of the
I have an ASP.MVC application which has a silverlight app inside. I want to
I have created a silverlight page in which i have different controls (all in
I have a simple test page in my Silverlight 4 application in which I'm
I have a Silverlight 4 application from which I'm attempting to display a PDF.
I have a Silverlight 2.0 listbox which reads in data from a custom list
I have a silverlight control on an html page in which I would like
I have a page which renders html content from the database. Now I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.