none
how to navigate one page to another

    General discussion

  • Hi Team,

    i wanted to know how can we navigate from one page to another .

    thanks in advance

    Friday, December 16, 2011 12:45 AM

All replies

  • Check Below Sample for Move One Page to Another

    http://stackoverflow.com/questions/2709274/how-can-i-navigate-one-xaml-page-to-another

    Friday, December 16, 2011 11:59 PM
  • You better use Silverlight Navigation Applicaton for navigation from one xaml to  another , if you are using silverlight 4 and vs2010:

    chk it out:

    http://msdn.microsoft.com/en-us/library/hh180767%28v=vs.91%29.aspx

    Tuesday, December 20, 2011 12:21 AM
  • Please try below

    this.NavigationService.Navigate(new Uri("/Products", UriKind.Relative));

    and for mainpage or Root change you can use RootVisual

    Tuesday, December 20, 2011 12:36 AM
  • Hi..

    1)Nav. Application

    String goToPage = "/MainPage.xaml”; this.Frame.Navigate(new Uri(goToPage, UriKind.Relative));OR

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

    2)  HtmlPage.Window.Navigate(new Uri(http://localhost:portno/Virtualdir/MainPage.aspx));

    Thank's

    Prasanta Kumar Pradhan

    Tuesday, December 20, 2011 4:35 AM
  • thank for reply

    this is only working when i m using silverlight Navigation Application but i my project i m not using this

     

    Tuesday, December 20, 2011 11:40 PM
  • thaks for reply

    i wanted to know how can i add Silverlight Navigation Application in the exiting project which is already devloped .since i m devloping a one module of this project when i m adding Silverlight Navigation in my folder(module) then it not giving the option  .

    pls help me to resolve this problem

    Wednesday, December 21, 2011 12:12 AM
  • this is only working when i m using silverlight Navigation Application but i my project i m not using this

    did you follow my link in previous post, for navigation from one page to other without navigation template

    http://social.msdn.microsoft.com/Forums/en-US/silverlightarchieve/thread/fc411935-8274-47df-8812-e96136ad380c#2bc68937-7992-463f-8f4b-43d19d1a9b13/1?Re+regarding+navigation+in+silverlight

    Wednesday, December 21, 2011 12:16 AM
  • Hi Sir

    i m test this but this is not fullfilling my requirement bcs in my project there is one page(suppose page1) where is one button and wanted to open another page (page2) on this button click

    Wednesday, December 21, 2011 1:29 AM
  • using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    
    namespace Test
    {
        public partial class App : Application
        {
    
         
    
            public static string UserName = string.Empty;
    
            public App()
            {
                this.Startup += this.Application_Startup;
                this.Exit += this.Application_Exit;
                this.UnhandledException += this.Application_UnhandledException;
    
                InitializeComponent();
            }
    
           
    
           
    
            private void Application_Startup(object sender, StartupEventArgs e)
            {
                var mainUi = new Grid();
                this.RootVisual = mainUi;
                mainUi.Children.Add(new MainPage());
            }
    
          
    
            private void Application_Exit(object sender, EventArgs e)
            {
    
            }
    
            private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
            {
                // If the app is running outside of the debugger then report the exception using
                // the browser's exception mechanism. On IE this will display it a yellow alert 
                // icon in the status bar and Firefox will display a script error.
                if (!System.Diagnostics.Debugger.IsAttached)
                {
    
                    // NOTE: This will allow the application to continue running after an exception has been thrown
                    // but not handled. 
                    // For production applications this error handling should be replaced with something that will 
                    // report the error to the website and stop the application.
                    e.Handled = true;
                    Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
                }
            }
    
            private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
            {
                try
                {
                    string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
                    errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
    
                    System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
                }
                catch (Exception)
                {
                }
            }
        }
    }
    
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    
    
    namespace Test
    
    {
    
        public partial class MainPage : UserControl
        {
            Sqlquerry.Service1Client webService = new Sqlquerry.Service1Client();
            public MainPage()
            {
                InitializeComponent();
                Loaded += new RoutedEventHandler(MainPage_Loaded);
            }
    
            void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                webService.GetUsernameByfirstnameCompleted += new EventHandler<Sqlquerry.GetUsernameByfirstnameCompletedEventArgs>(webService_GetUsernameByfirstnameCompleted);
                loginbtn.Click += new RoutedEventHandler(loginbtn_Click);
            }
            private void loginbtn_Click(object sender, RoutedEventArgs e)
            {
                webService.GetUsernameByfirstnameAsync(username.Text, password.Text);
                App.UserName = username.Text;
               
            }
            void webService_GetUsernameByfirstnameCompleted(object sender, Sqlquerry.GetUsernameByfirstnameCompletedEventArgs e)
            {
                if(e.Result != null && !string.IsNullOrEmpty(e.Result.ToString()))
                {
                    dgResults.ItemsSource = e.Result;
                    Grid grid = App.Current.RootVisual as Grid;
                    grid.Children.Clear();
                    grid.Children.Add(new Page1());
                }
                else
                {
                    
                }
                
            }
    
            }
        }
    
    Wednesday, December 21, 2011 4:35 AM