Opening a new form in Silverlight for Windows Phone 7

How to show a new form in Windows Phone 7? I initialized my class as follows:

Jeans jeansform = new Jeans("Elwood Curtis");

However, there is no jeansform.Show () method.

+3
source share
1 answer

Typically, a Windows Phone 7 application uses form navigation similar to the Silverlight navigation application hosted in a browser. This allows you to return to the previous phone button from the "pages" to which the transition was made.

Your form Jeansshould actually be inferred from PhoneApplicationPageand should have a simple default constructor (not the one that takes the parameter as you are now).

: -

NavigationService.Navigate(new Uri("/Views/Jeans.xml?name=Elwood%20Curtis"));

"" OnNavigatedTo: -

    protected override void OnNavigatedTo(Microsoft.Phone.Navigation.PhoneNavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
        Name = NavigationContext.QueryString["name"];
        // Other code you would have otherwise run in a parameterised constructor
    }
+5

Source: https://habr.com/ru/post/1769984/


All Articles