我需要创建带有一些隐藏列的 Grid 快照(通过将其设置为 ColumnDefinition.Width = 0)。
在屏幕上看起来不错,但created image
所有列都可见(does not respect the ColumnDefinitions)
。我在某处发红,这是因为 RenderTargetBitmap 正在查看不存在这些更改的不同层(视觉层与布局层)。是否有机会使用正确的 ColumnDefinitions 获得网格的真实快照?我不能简单地使用 Rectagnel.Fill = VisualBrush,因为我需要循环存储这些图像(每次迭代 = 新图像)。
我尝试了像这个片段这样的方法