'宣言 Public Property PageHeaderTemplate As DataTemplate
public DataTemplate PageHeaderTemplate {get; set;}
Private Sub SetReportSettings() Dim reportObj As New Report() Dim section As New EmbeddedVisualReportSection(XamDataGrid1) reportObj.Sections.Add(section) ' set header template reportObj.PageHeaderTemplate = TryCast(Me.Resources("PagePresenterHeaderTemplate"), DataTemplate) ' set header data reportObj.PageHeader = "MyHeader" reportObj.Print(False) End Sub
private void SetReportSettings() { Report reportObj = new Report(); EmbeddedVisualReportSection section = new EmbeddedVisualReportSection(XamDataGrid1); reportObj.Sections.Add(section); // set header template reportObj.PageHeaderTemplate = this.Resources["PagePresenterHeaderTemplate"] as DataTemplate; // set header data reportObj.PageHeader = "MyHeader"; reportObj.Print(false); }