URI Silverlight导航 [英] URI Silverlight Navigation
本文介绍了URI Silverlight导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我在Silverlight应用程序中浏览页面时遇到问题.我使用的是普通按钮而不是超链接按钮.
这是我的xaml代码:
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>
</navigation:Frame.UriMapper>
</navigation:Frame>
</Border>
<Grid x:Name="NavigationGrid" >
<ComboBox Height="24" HorizontalAlignment="Left" Margin="203,13,0,0" Name="comboBox1" VerticalAlignment="Top" Width="166" />
<TextBox Height="24" HorizontalAlignment="Left" Margin="54,14,0,0" Name="textBox1" VerticalAlignment="Top" Width="108" />
<Button Content="Button" Height="35" HorizontalAlignment="Left" Margin="422,21,0,0" Name="button1" VerticalAlignment="Top" Width="113" Click="button1_Click_1" />
</Grid>
</Grid>
还有我的代码:
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)));
推荐答案
删除下面的行,查看其是否有效
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));
其中pagename.xaml是页面的名称.
HTH.
where pagename.xaml is the name of the page.
HTH.
这篇关于URI Silverlight导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文