Skip to content
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

FindName Mention that it may return the parent object of same name #2325

Open
TranquilAbyss opened this issue Jun 13, 2024 · 0 comments
Open
Labels
area-Doc Issues related to documentation and XML comments

Comments

@TranquilAbyss
Copy link

Describe the update or improvement you would like to see

I would like to see added to the remarks of UIElement FindName additional text , checking parent first. or something equivalent.

Is this related to a specific part of the documentation?
UIElement.cs FindName() line 1086

Why is this update needed?
I found the current text misleading to the functionality in the case of the parent and child with the same name. Hopefully this change can help people spend less time next time it is encountered.

I had a button named after its function (ChangeOwner). But then did a refactor and made it part of a Grid called (ChangeOwner). I know I could practice better naming standards, but I thought this was fine due to the summery Finds an element that has the provided identifier name in the element children.. Since Button (ChangeOwner) was a child of Grid (ChangeOwner) I expected it to get the child element from the children of the Grid. When I tried to FindName("ChangeOwner") it returned the parent Grid instead of the Button.

Additional context
I am not sure if anyone is using this segment of FindName. I am not recommending removing it for now since it could be a breaking change.

if (Name == name)
    return this;

If its not used I think this code segment could be removed.

Proposed changes
If you have a specific change in mind, you can suggest the text or code snippet here.
/// <remarks>If several elements with the same name exist return the first found, checking parent first</remarks>

@TranquilAbyss TranquilAbyss added the area-Doc Issues related to documentation and XML comments label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Doc Issues related to documentation and XML comments
Projects
None yet
Development

No branches or pull requests

1 participant