VisualBrush does “lazy evaluation”?

Call .Freeze() on the VisualBrush in each iteration. Otherwise, it will always be a live view of whatever visual you pointed it at.

Up vote 0 down vote favorite share g+ share fb share tw.

I create FixedDocument in more iterations (one page per iteration) like this: PrintDialog pr = new PrintDialog(); FixedDocument doc = new FixedDocument(); foreach(var I in a) { // some changes of MaingGrid here ... // VisualBrush vb = new VisualBrush(this. MainGrid); FixedPage page = new FixedPage(); page. Width = doc.

DocumentPaginator.PageSize. Width; page. Height = doc.

DocumentPaginator.PageSize. Height; Rectangle rec = new Rectangle(); rec. Width = this.MainGrid.

ActualWidth; rec. Height = this.MainGrid. ActualHeight; rec.

Fill = vb; page.Children. Add(rec); PageContent content = new PageContent(); ((IAddChild)content). AddChild(page); doc.Pages.

Add(content); } pr. PrintDocument(doc. DocumentPaginator, "test"); In each iteration I change the MainGrid a little.

So each page should contain the actual state of MainGrid. But the printed document contains pages with same content of last iteration (in other words - the last state is on all pages in document). Is there any "lazy evaluation" of VisualBrush or something?

Wpf visualbrush fixeddocument link|improve this question asked Nov 7 '11 at 14:46karel557 86% accept rate.

Call .Freeze() on the VisualBrush in each iteration. Otherwise, it will always be a live view of whatever visual you pointed it at. EDIT: Freeze doesn't work but you can render the brush into a static bitmap.

See blog.avanadeadvisor.com/blogs/markti/arc....

Sounds good, but vb. CanFreeze is false. But you actualy confirm that it does some kind of lazy evaluation.

Thank you – karel Nov 7 '11 at 15:14 @karel - my bad. See the edited answer – Robert Levy Nov 7 '11 at 18:45 I need to keep it in vectors. So I used serialization: link – karel Nov 8 '11 at 7:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions