Tag: freezable

如何冻结无法冻结的freezable对象

在我的场景中,我想在我想在后台任务中渲染它之前冻结一个不变的BitmapCacheBrush。 不幸的是我收到错误“这个Freezable不能被冻结”。 是否有任何解决方法或hacky方式冻结也不是freezable对象? 也许可以通过reflection设置正确的属性来达到这个目标? 提前谢谢你们。 编辑:(我的示例代码请求) public static class ext { public static async Task RenderAsync(this Visual visual) { var bounds = VisualTreeHelper.GetDescendantBounds(visual); var bitmapCacheBrush = new BitmapCacheBrush(visual); bitmapCacheBrush.BitmapCache = new BitmapCache(); // We need to disconnect the visual here to make the freezable freezable :). Of course this will make our rendering blank //bitmapCacheBrush.Target […]