I need to create snapshot of Grid with some hidden columns (by setting it's ColumnDefinition.Width = 0).
On screen it looks fine, but the created image
has all columns visible (does not respect the ColumnDefinitions)
. I red somewhere that it is because the RenderTargetBitmap is looking at different layer where these changes aren't present (Visual layer vs. Layout layer). Is there any chance to get realistic snapshot of the grid with correct ColumnDefinitions? I cannot simply use Rectagnel.Fill = VisualBrush, because I need to store these images in cycle (every iteration = new image).
I tried ways like this snippet
It was needed to force
UpdateLayout()
before each snapshot. I changed the sizes in cycle and layout was updated too late.