我在我的WPF应用程序中使用ReportViewer。
我试图在我的c#代码中触发一个函数,按钮将在ReportViewer上。
我想知道如何触发DrillThrough?
void DemoDrillThroughEventHandler(object sender, DrillthroughEventArgs e)
{
MessageBox.Show("Drillthrough worked");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
this._reportViewer.Drillthrough += new DrillthroughEventHandler(DemoDrillThroughEventHandler);
this._reportViewer.Reset();
....
this._reportViewer.LocalReport.Refresh();
this._reportViewer.RefreshReport();
}
}
发布于 2014-10-27 15:44:20
有时有一种方法会引发事件(例如,在winforms中有Button.PerformClick
)。否则,您可以将事件处理程序中的代码放在单独的函数中,并直接调用它。
最简单的解决方案
DemoDrillThroughEventHandler(this._reportViewer, new DrillthroughEventArgs());
或者甚至(取决于内部发生了什么)
DemoDrillThroughEventHandler(null, null);
https://stackoverflow.com/questions/26590611
复制