FindAscendantOrTop Visual Tree helper? #4771
Replies: 2 comments 2 replies
-
Mmh yeah that seems reasonable, though I wonder if it's not too niche 🤔 In the meantime, would this work? element.FindAscendant<DependencyObject>(obj => obj is <WHATEVER> || VisualTreeHelper.GetParent(obj) is null); As for the name if we did add this, maybe |
Beta Was this translation helpful? Give feedback.
-
Ah, I also noticed @Sergio0694 we didn't implement the breadth/depth first search option for the logical helpers, only the visual ones. I'm also realizing I want the depth restriction for adorners as well... like walk up to a ScrollViewer and then look down at most two levels for an AdornerLayer (contained within a Grid for instance as the content of the ScrollViewer). I know these are technically new features for a patch release, but we've already got them in main for 7.1.3, so wondering if we want to make these improvements now? (Or should we revert the imporvement PR to re-introduce after more uniformly?) Thoughts? FYI @Arlodotexe |
Beta Was this translation helpful? Give feedback.
-
We have FindAscendant and FindAscendantOrSelf, wondering if we need a
FindAscendantOrTop
which will return the top-most element that matches even if it fails to find in the exhaustive search at the top...?Scenario: CommunityToolkit/Labs-Windows#278 - for Adorners, I want to basically walk the way to the top of the app, but if I don't find something, I still want the top-most 'root' element of the tree instead of
null
(as the current behavior would be).@Sergio0694 thoughts?
Beta Was this translation helpful? Give feedback.
All reactions