1

I have a "huge" Control where ~50% of it is collapsed. You can switch by a property to hide the visible part and show the collapsed one.

Now when the Control is loaded, I try to find all FooControls in the visible and collapsed part of the control. The problem is, that only the FooControls of the visible part are found. If I debug the code, I can see FooControls in the parent Control of the collapsed part.

Can you give me a hint how to solve this problem?

I need to change a Property of FooControl after it's loaded. I also need to be dynamic, because it comes with a behavior.

Dominic Jonas
  • 4,717
  • 1
  • 34
  • 77
  • 2
    When the Visibility of a UIElement is set to Collapsed, it is removed from the visual tree. That's why the VisualTreeHelper won't be able to find collapsed elements. I don't know what you are trying to do but you will need to find another way. – mm8 Apr 20 '17 at 10:23

1 Answers1

0

The answer is simply to use Logical Tree Helper , Visual Tree helper finds all the objects that are visible, while logical can see all controls made, you might have to refine your code a bit but as you haven't given any more information, I can't help.

JohnChris
  • 1,360
  • 15
  • 29