I am using RenderTargetBitmap
to capture the content of a control in XAML.
I am aware of using Visibility="Collapse" that would hide the control, but when the control is collapsed then RenderTargetBitmap
renders a blank image, because according to the docs
Content that's in the tree but with its Visibility set to Collapsed won't be captured.
and
Content that can't be captured will appear as blank in the captured image, but other content in the same visual tree can still be captured and will render (the presence of content that can't be captured won't invalidate the entire capture of that XAML composition).
However I don't want to display it on the screen.
I was looking for something like a z-index or a layer, so I don't display it but still be able to capture that element.
Alternatively some other way that does not use RenderTargetBitmap
that renders the element even though the visibility
is set to collapse