locked
Im so lost/stuck: In code navigation. RRS feed

  • Question

  • Hi,

    I'm trying to make a code based navigation. What i am trying to do is make an username/password page. I design is done and i used C# code to use the sample database that expression blend supplies. It works but i am trying to make the page go to another page if it fails or is success when i press the enter button.

    How do i do that in code?

    Do i need to a custom trigger? 

    Is there an way to make an trigger work without code so i can do this easier?

    Any information would be helpful, 

    Owen
    Tuesday, January 5, 2010 6:49 AM

All replies

  • I can help you with a Window solution in a WPF application. Your new window is a xaml file inside your project, let's say it LoginError.xaml. Inside the Button_Click code you should write
    VB
    LoginErrorerror error = New LoginError()
    error.ShowDialog()

    if you write error.Show() then the window behind will be enabled.
    Tuesday, January 5, 2010 8:40 AM
  • delete VB ... :-)
    Tuesday, January 5, 2010 8:41 AM
  • I don't think that you can do this without some lines of code.

    Do you have a wpf or Silverlight App?

    I made an empty Grid/Canvas as Placeholder in which i places my new Pages after the navigation-event was fired.
    So if the Login was a Success you can add the Success-Page

    this.ContentHolder.Children.Add(UIPage);

    • Proposed as answer by Stef S Tuesday, January 5, 2010 12:20 PM
    Tuesday, January 5, 2010 11:43 AM
  • Im doing an silver light app. i tried your code and i still cant get the children thing to work.

    I tried your way and i got one xaml page called "MainPage.xaml" and, "LoginSuc.xaml", and "LoginFail.xaml".

    How do i use "this.ContentHolder.Children.Add(UIPage);"? I name each xaml and still cant get them ported into the project.
    Saturday, January 9, 2010 1:46 AM
  • I used a Canvas for as the Contenholder.

    So you can use:

    UIPage page = null;
    
    if (loginSuccess)
    {
      page = new LoginSuc();
       ChangeContent(page);
    }
    else
    {
       page = new LoginFail();
       ChangeContent(page);
    }
    
    
    
    ChangeContent(UIPage page)
    {
      this.ContentHolder.Children.Clear();
      this.ContentHolder.Children.Add(page);
    }
    Hope this helps
    Saturday, January 9, 2010 9:45 AM