Feature/extended tree helpers#4333
Merged
Sergio0694 merged 12 commits intoCommunityToolkit:mainfrom Jan 4, 2022
Merged
Conversation
|
Thanks Sergio0694 for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
Member
michael-hawker
left a comment
There was a problem hiding this comment.
Some initial comments, haven't gone through everything yet, but almost lost them accidently, so while I had some just going to send them over. 🙂
11 tasks
XAML-Knight
suggested changes
Oct 29, 2021
UnitTests/UnitTests.UWP/Extensions/Test_VisualTreeExtensions.cs
Outdated
Show resolved
Hide resolved
UnitTests/UnitTests.UWP/Extensions/Test_VisualTreeExtensions.cs
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI/Extensions/DependencyObjectExtensions.cs
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI/Extensions/DependencyObjectExtensions.cs
Outdated
Show resolved
Hide resolved
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 30 days of this comment. |
|
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
XAML-Knight
approved these changes
Dec 16, 2021
Arlodotexe
reviewed
Dec 17, 2021
Microsoft.Toolkit.Uwp.UI/Extensions/DependencyObjectExtensions.cs
Outdated
Show resolved
Hide resolved
0b28ee9 to
888ec93
Compare
Arlodotexe
approved these changes
Jan 3, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4300
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Some visual tree helpers are missing, and there is no way to specify the search type.
What is the new behavior?
Added the missing APIs discussed in the issue and listed below.
API breakdown
namespace Microsoft.Toolkit.Uwp.UI { + public enum SearchType + { + DepthFirst, + BreadthFirst + } public static class DependencyObjectExtensions { public static FrameworkElement? FindDescendant(this DependencyObject element, string name, StringComparison comparisonType = StringComparison.Ordinal); + public static FrameworkElement? FindDescendant(this DependencyObject element, string name, StringComparison comparisonType, SearchType searchType); public static T? FindDescendant<T>(this DependencyObject element) where T : notnull, DependencyObject; + public static T? FindDescendant<T>(this DependencyObject element, SearchType searchType) where T : notnull, DependencyObject; public static DependencyObject? FindDescendant(this DependencyObject element, Type type); + public static DependencyObject? FindDescendant(this DependencyObject element, Type type, SearchType searchType); public static T? FindDescendant<T>(this DependencyObject element, Func<T, bool> predicate) where T : notnull, DependencyObject; + public static T? FindDescendant<T>(this DependencyObject element, Func<T, bool> predicate, SearchType searchType) where T : notnull, DependencyObject; public static T? FindDescendant<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate) where T : notnull, DependencyObject; + public static T? FindDescendant<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate, SearchType searchType) where T : notnull, DependencyObject; public static FrameworkElement? FindDescendantOrSelf(this DependencyObject element, string name, StringComparison comparisonType = StringComparison.Ordinal); + public static FrameworkElement? FindDescendantOrSelf(this DependencyObject element, string name, StringComparison comparisonType, SearchType searchType); public static T? FindDescendantOrSelf<T>(this DependencyObject element) where T : notnull, DependencyObject; + public static T? FindDescendantOrSelf<T>(this DependencyObject element, SearchType searchType) where T : notnull, DependencyObject; public static DependencyObject? FindDescendantOrSelf(this DependencyObject element, Type type); + public static DependencyObject? FindDescendantOrSelf(this DependencyObject element, Type type, SearchType searchType); public static T? FindDescendantOrSelf<T>(this DependencyObject element, Func<T, bool> predicate) where T : notnull, DependencyObject; + public static T? FindDescendantOrSelf<T>(this DependencyObject element, Func<T, bool> predicate, SearchType searchType) where T : notnull, DependencyObject; public static T? FindDescendantOrSelf<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate) where T : notnull, DependencyObject; + public static T? FindDescendantOrSelf<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate, SearchType searchType) where T : notnull, DependencyObject; public static IEnumerable<DependencyObject> FindDescendants(this DependencyObject element); + public static IEnumerable<DependencyObject> FindDescendants(this DependencyObject element, SearchType searchType); + public static IEnumerable<DependencyObject> FindDescendantsOrSelf(this DependencyObject element); + public static IEnumerable<DependencyObject> FindDescendantsOrSelf(this DependencyObject element, SearchType searchType); + public static IEnumerable<DependencyObject> FindFirstLevelDescendants(this DependencyObject element); + public static IEnumerable<DependencyObject> FindFirstLevelDescendantsOrSelf(this DependencyObject element); public static FrameworkElement? FindAscendant(this DependencyObject element, string name, StringComparison comparisonType = StringComparison.Ordinal); public static T? FindAscendant<T>(this DependencyObject element) where T : notnull, DependencyObject; public static DependencyObject? FindAscendant(this DependencyObject element, Type type); public static T? FindAscendant<T>(this DependencyObject element, Func<T, bool> predicate) where T : notnull, DependencyObject; public static T? FindAscendant<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate) where T : notnull, DependencyObject; public static FrameworkElement? FindAscendantOrSelf(this DependencyObject element, string name, StringComparison comparisonType = StringComparison.Ordinal); public static T? FindAscendantOrSelf<T>(this DependencyObject element) where T : notnull, DependencyObject; public static DependencyObject? FindAscendantOrSelf(this DependencyObject element, Type type); public static T? FindAscendantOrSelf<T>(this DependencyObject element, Func<T, bool> predicate) where T : notnull, DependencyObject; public static T? FindAscendantOrSelf<T, TState>(this DependencyObject element, TState state, Func<T, TState, bool> predicate) where T : notnull, DependencyObject; public static IEnumerable<DependencyObject> FindAscendants(this DependencyObject element); + public static IEnumerable<DependencyObject> FindAscendantsOrSelf(this DependencyObject element); + public static bool IsDescendantOf(this DependencyObject child, DependencyObject element); + public static bool IsAscendantOf(this DependencyObject parent, DependencyObject element); } }PR Checklist
Please check if your PR fulfills the following requirements: