Reputation: 27653
Original question:
The following is not enough:
this.Background = Brushes.Yellow;
RenderTargetBitmap bmp = new RenderTargetBitmap(...);
Measure(...);
Arrange(...);
bmp.Render(this);
If the color was different before this code being executed, the color is still the old color instead of changing to yellow.
So what step am I missing?
(It does work if I add an await Task.Delay(100);
before rendering it, but seems to be an ugly workaround.)
Upvotes: -1
Views: 84
Reputation: 27653
[posting a temporary answer until the commenter posts their own.]
The problem was solved in a comment - adding UpdateLayout before rendering the Visual to the bitmap was enough.
Upvotes: 0