Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Navigate in Frame from code

Navigate in Frame from code

Scheduled Pinned Locked Moved WPF
wpfhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yesu prakash
    wrote on last edited by
    #1

    Hi, How can i navigate to another page in a frame from code behind. ex: I have a navigate frame, when i click on a link button from outside navigate frame i need to navigate it to another page by writing code behind. i try .. ContentFrame.UriMapper.MapUri(new Uri(@"/EmployeeList.xaml")); ContentFrame.Source = new Uri("/EmployeeList.xaml"); in the click event. error i get is Microsoft JScript runtime error: Unhandled Error in Silverlight Application Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString) at HRMS.MainPage.Menu_MenuItemClicked(Object sender, EventArgs e) at SilverlightMenu.Library.Menu.gridLevel2_MouseLeftButtonUp(Object sender, MouseButtonEventArgs e) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName) Thankyou, YPKI

    M 1 Reply Last reply
    0
    • Y yesu prakash

      Hi, How can i navigate to another page in a frame from code behind. ex: I have a navigate frame, when i click on a link button from outside navigate frame i need to navigate it to another page by writing code behind. i try .. ContentFrame.UriMapper.MapUri(new Uri(@"/EmployeeList.xaml")); ContentFrame.Source = new Uri("/EmployeeList.xaml"); in the click event. error i get is Microsoft JScript runtime error: Unhandled Error in Silverlight Application Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString) at HRMS.MainPage.Menu_MenuItemClicked(Object sender, EventArgs e) at SilverlightMenu.Library.Menu.gridLevel2_MouseLeftButtonUp(Object sender, MouseButtonEventArgs e) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName) Thankyou, YPKI

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      I have a static method that I call from any forms code behind. The default frame is the main navigation frame but I can pass in a frame if required

      public static void NavigateTo(string sViewName)
      {
      //Get the content frame from the main page via the application
      Frame oFR = (Application.Current.RootVisual as FrameworkElement).FindName("MainContent") as Frame;
      NavigateTo(oFR,sViewName);
      }

      public static void NavigateTo(Frame oFR, string sViewName)
      {
      if(!sViewName.StartsWith("/"))
      {sViewName = string.Format("/{0}",sViewName);}
      oFR.Navigate(new Uri(sViewName, UriKind.Relative));
      }

      And call it passing in the name of the view. The view is in the app.xaml of course. Do some research into Silverlight navigation projects.

      gUI.NavigateTo(sURL);

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups