Click here to Skip to main content
11,634,827 members (65,239 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# XML
Hello, I am having a problem navigating to pages in my silverlight App. I am using a normal button instead of a Hyperlink button.

Here is my xaml code:
            <navigation:Frame x:Name="ContentFrame"
                              Source="/RequestViews" Navigated="ContentFrame_Navigated"  Height="279" Width="494" HorizontalAlignment="Right">
                <navigation:Frame.UriMapper>
                    <uriMapper:UriMapper>
                        <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/RequestViews/Home.xaml"/>
                        <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/RequestViews/{pageName}.xaml"/>
                    </uriMapper:UriMapper>
and my code behind:
        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
           // ContentFrame.Navigate(new Uri("/Home", UriKind.Relative));

        }
I have also tried:
 this.Dispatcher.BeginInvoke(() => this.ContentFrame.Navigate(new Uri("/Home", UriKind.Relative)));
Posted 13-Jun-12 5:46am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Remove below line and see if it is working or not
<urimapper:urimapping uri="/{pageName}" mappeduri="/RequestViews/Home.xaml" xmlns:urimapper="#unknown" />

Also it has nothing to do with the link control or button.

I can simply write
this.ContentFrame.Navigate(new Uri("/pagename", UriKind.Relative));

where pagename.xaml is the name of the page.

HTH.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,419
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205


Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100