Showing/Hiding Nodes based on property and expanded state

Hi,

I have a diagram that contains parent nodes (“tasks”) and child nodes (“cases”). I can collapse/expand child nodes binding to the Group.IsSubGraphExpanded attached property on the parent node with no problem.

I also have the need to show/hide nodes based on another (non-GoXam) property ("InScenario). So a child node should be visible only if:

parent node is visible AND parent node is expanded AND InScenario is true

I have tried or considered a number of different things, based on other issues in the forum. Some things I’ve tried:

  • Binding two-way to Part.Visible (setter sets an private member; getter ANDs this with InScenario) [This seems to eventually causes GoXam to “lose its place”, since it is setting the property to one value and getting a different value.]
  • Setting Part.Visible via triggers, looking at Node.ContainingSubGraph.IsExpandedSubGroup and InScenario [Once a collapse is executed, the triggers are no longer active.]
  • Binding to Node.IsTreeExpanded (the binding seems go get overwritten, even if the binding is two-way)

Is there any way to do this?

Thank you.

I was able to solve this by tracking the expanded state myself and including that in the getter bound to Part.Visible. Essentially:

Part.Visible (binding) = ((this is parent) || (this is child and child’s parent is expanded)) && InScenario is true

Of course, InScenario is true can be replaced with any conditionals.