I would like to print a user control with data binding. I'm very confused about this and don't even know if it is possible. I have a class which implements DocumentPaginator and I would like to do something like this:
public override DocumentPage GetPage(int pageNumber)
{
UserControl myUC = new View.MyUserControl();
myUC.DataContext = this;
return new DocumentPage(myUC);
}
The xaml of myUC user control contains a label like the following:
<Label Content="{Binding myName}" FontSize="18" Height="20"/>
where myName is a property defined in the class.
The user control is correctly printed but the binding is not applied. Is it possible some way ? What can I do ?
Please considered this is an extremely simplified example of what I would like to do. My final goal is more like design a form in xaml and then print it with my data.
Update
I will read this post more carefully. At a first try calling Measure, Arrange, and UpdateLayout on the user control seem promising for my goal.