首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么在WPF上用Hyperlink实现xaml窗体间传递参数

2012-09-14 
如何在WPF下用Hyperlink实现xaml窗体间传递参数TextBlock bt new TextBlock(){Width 125,Height 30,

如何在WPF下用Hyperlink实现xaml窗体间传递参数
TextBlock bt = new TextBlock()
{
  Width = 125,
  Height = 30,
  FontSize = 16,
  Margin = new System.Windows.Thickness((double)5),
};
Run run3 = new Run(ds.Tables[0].Rows[i][1].ToString());
Hyperlink hyperlink = new Hyperlink(run3)
{
  NavigateUri = new Uri("StationInformationDisplay.xaml",UriKind.Relative),
  CommandParameter = ds.Tables[0].Rows[i][0].ToString() as Object  
};
bt.Inlines.Add(hyperlink);
lv_Data.Children.Add(bt); //lv_Data 是 UniformGrid

如何实现参数传递,将 ds.Tables[0].Rows[i][0].ToString() 当参数传递到 StationInformationDisplay.xaml
如何接收传递过来的参数

请教各位编程大侠了,谢谢!!

[解决办法]
NavigationService 可以捕获当前的URI信息。

不过不知道你为何用用URI导航去加载窗体?

为何不自己New一个StationInformationDisplay, 并设置StationInformationDisplay的属性即可传递你想传递的对象。

热点排行