在MainWindow
构造函数中,我正在注册一个事件处理程序:
public partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
pageViewDocText = new PageViewDocText();
framePageDocFieldDetail.Content = pageViewDocText;
pageViewDocText.NewPageIRPRO += new GabeLib.SearchCls.DocEventHandler(ViewIPRO);
}
protected void ViewIPRO(string IRPOlink) // ...
}
public partial class PageViewDocText : Page, INotifyPropertyChanged
{
public event GabeLib.SearchCls.DocEventHandler NewPageIRPRO;
private void btn_PageBreakNext(object sender, RoutedEventArgs e)
{
// this fires but NewPageIRPRO is null
if (NewPageIRPRO != null)
{
NewPageIRPRO("dummylink");
}
}
}
但在 中PageViewDocText
,NewPageIRPRO
为空
我究竟做错了什么?
从PageViewDocText
,我想打电话MainWindow.ViewIPRO
。
此事件处理程序触发并注册 pageViewDocText.NewPageIRPRO += 下面的行
App.StaticGabeLib.Search.NewDocIRPRO += new GabeLib.SearchCls.DocEventHandler(ViewIPRO);