DrawingVisual performance with Opacity=0

前端 未结 4 1694
刺人心
刺人心 2021-01-13 19:54

If I have a DrawingVisual in WPF with Opacity=0, is that enough for it not to be drawn? We have hundreds of DrawingVisuals on a Canvas, and are currently setting Opacity=0 o

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 20:30

    The best way to check would be to instead set the Visibility to Visibility.Colapsed, and see if there's any drawing performance differences.

    Visibility.Colapsed ensures that the element is not visible but also that it will not participate in the Arrange, Measure and Render passes of the UI, while an element with Opacity=0 might participate in all passes.

提交回复
热议问题