In a Silverlight application, create a button and drop a Frame control. If you set the Source property of this Frame control to another page (let's say "/anotherpage.xaml") in design time it will work just fine when you execute this application. But if you want to navigate to a different page using code you may write a code that looks like this…
private void btnNavigate_Click(object sender, RoutedEventArgs e){
frame1.Source = (new Uri("/anotherpage.xaml");
}
If you execute your application it will error out, saying…
Invalid URI: The format of the URI could not be determined.
To get rid of this problem, use the following code…
private void btnNavigate_Click(object sender, RoutedEventArgs e){
frame1.Source = (new Uri("/anotherpage.xaml", UriKind.Relative));
}
Cheers,
Rahul
Quote of the day:
Adventure is just bad planning. - Roald Amundsen