Reputation: 10981
I'm playing around 3d objects in WPF. I have a viewport3d. This contains two 3d object (ModelVisual3d) named "A" and "B".
I want to just show A and hide B,
sometimes, I want to just show B and hide A.
How can I do hide it?
I'm found answer, but this tell "set the OffsetX property to 1000.". I don't like it.
Is it possible to hide object?
Upvotes: 1
Views: 2445
Reputation: 31
Are you working only with xaml? You could just remove the ModelVisual3D object from the viewport and add them when you need want them visible. Like:
Visual3D A = ...
Visual3D B = ...
// invisible A, visible B
viewport3d.children.remove(A)
viewport3d.children.add(B)
// visible A, invisible B
viewport3d.children.add(A)
viewport3d.children.remove(B)
Just make sure you keep the A (and B) reference somehow.
Upvotes: 1