Open objorke opened 10 years ago
Where does this issue stand?
I think the proposed solution disconnecting the visuals is better than changing the material.
I am not sure if @survivorx is still working on this, so I have marked the issue "you(anyone) take it"!
+1 for Attached Properties.
This issue was imported from CodePlex
objo wrote 2013-09-29 at 09:31 Add an attached property to show/hide
Visual3D
s andModel3D
sWhen hiding:
ModelVisual3D
ContainerUIElement3D
ModelUIElement3D
remove from the parent's Children collection
Model3D
if parent is a
ModelVisual3D
- remove it from parent's Contentif parent is a
Model3DGroup
- remove it from parent's ChildrenWhen removing from collections - add an empty placeholder in the collection (and make it thread safe)
Store old parents and placeholders in temporary attached properties
https://helixtoolkit.codeplex.com/workitem/10000
survivorx wrote 2013-09-29 at 11:34 I'll contribute this.
For GeometryModel3D we need a different solution using a dictionary because it's not a DependencyObject.
survivorx wrote 2013-09-29 at 12:46 Ok, after really looking at this I must admit I wrongly assumed Visual3D or ModelVisual3D had a Material property, but it's a property of BillboardVisual3D (and probably other Helix classes). So there is no easy general solution using Material.
A better solution might be disconnecting the Content from the Visual3D. This would affect the properties Visual3D.Visual3DModel (protected, reflection needed), ModelVisual3D.Children and ModelVisual3D.Content.
survivorx wrote 2013-09-30 at 17:15 Here is a solution for ModelGeometry3D using Material:
You can bind it to a ToggleButton like this: