Hello.
I'm trying to generate a flowdocument that is made from a view bound to a viewmodel.
I have done this earlier, but then I had to bind the view to the viewmodel by hand. At the time it was not a problem, because the viewmodel was really small. But this time...
Binding that works would really help. The problem seems to be that I do not show my usercontrol, but rather use it to generate a flowdocument.
Here is some code:
Dim ireport As ViewModel.Reports.IReport = TryCast(reportvm, ViewModel.Reports.IReport)
Dim ReportDocument As New FlowDocument()
ReportDocument.ColumnWidth = 1122.7086
For i = 0 To Math.Ceiling(ireport.NrOfItems / ireport.ItemsOnPage) - 1
Dim inlinecontainer As New InlineUIContainer
Dim ReportView As View.Reports.IReportView = repviewgenerator()
ReportView.DataContext = reportvm
ReportView.FixTable(i + 1)
inlinecontainer.Child = ReportView
RepportDocument.Blocks.Add(New Paragraph(inlinecontainer))
ireport.PageNr += 1
Next
Dim dps As IDocumentPaginatorSource = ReportDocument
Handelse.Utils.PrintHelper.CreateDocumentPackage(dps)
The funny thing is that binding does occur, but the value does not show up on the flowdocument...
( I know this because I have tried to bind to a non existing property and then I received an error in the output window, but now I get no error, and if I put a breakpoint in a bound property, the property is getting hit.)
I have tried to call UpdateLayout on the view, but that does not help.
IReportView is a simple interface that I put on views that can be passed on to this function. (for paging)
The view is a UserControl.
Any help appreciated.