I'm trying to convert XAML control to XPS document, but I want to do this in batches mode - Rend control to print on the XPS without having to render it in memory and on the screen. This project should also work without the GUI.
I have read, but it is not working properly. I can make control, set up datacentext, but output is empty. If I provide control over the screen and then print it then everything is fine, but if I want to do it in batch mode, then I have found an empty document (only stable labels were there)
How do I force the control to force the controls with data?
The next hard part will be: How do I add my custom headers to each page if I print long-page page control? (Eg list?)
I am leaving my second question because it is very complex standalone.
I had to face the same problem, but could be due to some different things.
If the problem is that the binding has not yet been "tripped", the solution is slightly but if you control the data contact type it is easy to do. You only add a public or internal method for your type, so that you can turn events off by changing assets for each public property. Here's an example:
Public interface IForceBinding: INotifyPropertyChanged {zero force bonding (); } Public class MyDataContext: IForceBinding {changed the public event property; Private string _text; Set the public string text {get {return_text;} {_text = value; OnPropertyChanged ("text");}} Public ZeroBalbindings () {Onprotective Chengalated ("Text"); } Private Zero OnPropertyChanged (string propertyName) {// You know the drill}}
Then, you can use it like this:
Public Zero Print (MyDataContext preconfiguredContext) {var page = new MyWpfPage (); Page.DataContext = preconfiguredContext; PreconfiguredContext.ForceBindings (); // xps to write
If that does not work, you may have to face a bug where the binding on the first page is never shown
< / Div> Before I can find that solution again.
Comments
Post a Comment