Change currentpage, totalpages, ... of WPF ReportViewer to Dependency Property
Change Currentpage, TotalPages, DocumentMap properties to Dependency Property... to enable DataBinding...
3 comments
ADMIN
Milen | Product Manager @DX
Posted on:23 Nov 2017 07:51
We can expose most of the properties as dependency properties. Thank you for your request.
Michael
Posted on:16 Sep 2015 08:22
Hello,
i think that is a good Idea to change this Properties.
Here is my Scenario...
To determine the start of a report in a ReportBook, i use the following code:
ReportBook m_Book = new ReportBook();
m_Book.Reports.Add(m_Report1);
m_Book.Reports.Add(m_Report2);
m_Book.DocumentName = "Sample Report";
InstanceReportSource m_Source = new InstanceReportSource();
m_Source.ReportDocument = m_Book;
m_Window = new ReportPreview();
m_Window.ReportViewer.ReportSource = m_Source;
m_Window.ReportViewer.RenderingEnd += ReportViewer_RenderingEnd;
m_Window.WindowState = WindowState.Maximized;
m_Window.ShowDialog();
private void ReportViewer_RenderingEnd(object sender, EventArgs e)
{
// Get the ControlTemplate from ReportViewer Control
var template = m_Window.ReportViewer.Template;
// Get the RadTreeView from DocumentMapTreeView
var myControl = (RadTreeView)template.FindName("DocumentMapTreeView", m_Window.ReportViewer);
// Clear the Collection
m_DocumentMapList.Clear();
foreach (DocumentMapNodeModel m_Item in myControl.ItemsSource)
{
// Get the Item and add to local Collection
m_DocumentMapList.Add(m_Item);
}
m_Window.ReportViewer.RenderingEnd -= ReportViewer_RenderingEnd;
// here i make the Table of Contents...
TableOfContents.Add(new CustomObject("I.", "First Chapter", m_DocumentMapList.Where(x => x.Label == "DocumentMapText").FirstOrDefault().Page));
TableOfContents.Add(new CustomObject("II.", "Second Chapter", m_DocumentMapList.Where(x => x.Label == "AnotherDocumentMapText").FirstOrDefault().Page));
// Refresh the Reports
m_Window.ReportViewer.RefreshReport();
}
it works, but this way is somewhat inconvenient
My example is only a small excerpt from the complete code
ADMIN
Iana Tsolova
Posted on:08 Jun 2015 11:50
Hi,
Can you elaborate a bit on your use case and give us more details on the scenario you are trying to implement?
Thank you for your help in advance,
Iana