Reputation: 21098
Is it possible in WPF to find a visual parent of an object (UIElement
) before the loaded event was triggered? If i search for a specific parent in the loaded event, every thing works fine. If i search for a specific parent in the constructor after LoadComponent
, it does not work. Or do i have to use the logical tree?
I use the VisualTreeHelper
for searching.
Thank you
Upvotes: 1
Views: 402
Reputation: 12846
WPF only inserts the elements into the tree (logical or visual) after the constructor was called. So you cannot find the parent elements in the constructor.
It wouldn't make sense to insert something that does not exist yet into the tree.
Upvotes: 3