Esempio n. 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
			//We are going to cast the property Parameter of NavigationEventArgs object
			//into PageWithParametersConfiguration.
			//PageWithParametersConfiguration contains a set of parameters to pass to the page 			
            _pageParameters = e.Parameter as PageWithParametersConfiguration;
            if (_pageParameters != null)
            {
                MessageText.Text = _pageParameters.Message;
                MessageText.Text += "\nPage ID: " + _pageParameters.Id.ToString();
            }
        }
        private void NavigateButtonClick(object sender, RoutedEventArgs e)
        {
			//We have created a class to serialize the set of parameters that we need to pass
			//the page.
            PageWithParametersConfiguration pageParameters = new PageWithParametersConfiguration();
            
            if (MessageTextBox.Text == String.Empty)
            {
                pageParameters.Message = "This Page was created on: " + DateTime.Now.ToLocalTime();
            }
            else
            {
                pageParameters.Message = MessageTextBox.Text;
            }

			//The second parameter of navigate method contains the parameters that 
			//will be passed to the page.
            MyFrame.Navigate(typeof(PageWithParameters), pageParameters);
        }