-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Improve/extend the visual tree extensions #4300
Comments
Hello, 'Sergio0694! Thanks for submitting a new feature request. I've automatically added a vote 👍 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future! |
Would be great if the Toolkit could support this! |
One I've found quite useful is something like |
|
Talked to Sergio and we decided we should keep these for 8.0 instead of including in the hotfix release that we decided to ship. Will revert the commit for now and then we'll work to port these all into the new Labs-type infrastructure and add these back along with some other helpers/tweaks we've discovered along the way like #4771 and the depth parameter. |
Describe the problem this feature would solve
The
DependencyObjectExtensions
exposes APIs that offer a very convenient (and efficient) way to interact, query and traverse items in the visual tree linked to a given object. There are currently some limitations though that force developers (eg. us in the Store team) to have to implement some additional features manually. I think it would make sense to address them with a single implementation in the Toolkit that we and others could then use as well. This would reduce complexity from other codebases and offer a streamlined and consistent way to perform all these more advanced operations when working with visual trees.The current limitations are as follows, in no particular order:
VisualTreeHelper
exposes APIs to get the children count and then get children at a specified offset. We're missing a helper to just put these two together.FindAscendants
andFindDescendants
methods lack a correspondingOrSelf
version like other APIs.Describe the solution
I propose to add the following set of new APIs to solve the issues mentioned above:
Describe alternatives you've considered
Do nothing and let each developer reimplement the extensions needed manually. As mentioned above, this is not ideal as it adds complexity, increases the API surface to test and maintain for everyone, and likely will result in developers not implementing these APIs in the most efficient way possible (because everyone has limited time, or might not be experienced enough, or care).
Open questions
GetChildren
return anIEnumerable<T>
instead of an array?FrameworkElementExtensions
type?The text was updated successfully, but these errors were encountered: