Skip to content

FrameworkElement.FindName doesn't look for resources #7043

Closed as duplicate

Description

@Youssef1313

Current behavior

    <Grid x:Name="grid">
        <Grid.Resources>
            <Button x:Name="MyButton" />
        </Grid.Resources>
        <Button Click="Button_Click"></Button>
    </Grid>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var x = grid.FindName("MyButton"); // Returns null.
        }

Expected behavior

Shouldn't return null, as in UWP.

How to reproduce it (as minimally and precisely as possible)

↑

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

iOS, Android, WebAssembly, macOS, Skia (WPF), Skia (GTK on Linux/macOS/Windows), Skia (Tizen)

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on Sep 13, 2021
  2. added
    project/resources 🈷️
    on Sep 13, 2021
  3. added
    difficulty/medium 🤔
    low-hanging-🍒
    and removed
    triage/untriaged
    difficulty/tbd
    on Jul 18, 2023
  4. self-assigned this
    on Apr 8, 2024
  5. MartinZikmund commented on Jul 23, 2025

    @MartinZikmund
    Member
  6. github-actions commented on May 3, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.

  7. locked as resolved and limited conversation to collaborators on May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

difficulty/medium 🤔kind/buglow-hanging-🍒project/resources 🈷️

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions