3

I'm trying to optimize my WPF/VB.net program, and I'm considering freezing some objects. However, while I know that an object that is animated in any way cannot be frozen, I need to know...can you change the visibility of a frozen object?

Thank you!

CodeMouse92
  • 6,840
  • 14
  • 73
  • 130

1 Answers1

1

Freezing a Freezable object conceptually makes it immutable so an attempt to write to any writable properties should throw an exception, including Visibility. You can however implicitly affect a Freezable object's state by containing it in a non-freezable object. For example, you can use a Grid or any other Panel as a wrapper and toggle the Visibility of the container and it will affect the seemingly immutable frozen object indirectly. That being said, freezing doesn't really buy you very much efficiency-wise unless you are making quite a lot of copies of the object.

Rick Sladkey
  • 33,988
  • 6
  • 71
  • 95