stride3d / stride3d/stride

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

Open
#2,325 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Doc
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

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>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open UIElement.cs and inspect the FindName() documentation around line 1086, including the parent-name behavior described in the issue. Update the remarks to clarify that a matching parent may be returned first, then review the surrounding documentation for consistency.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.