日期:2014-05-18  浏览次数:20959 次

如何在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的属性即可传递你想传递的对象。