diff --git a/dotnet-desktop-guide/wpf/advanced/how-to-find-an-element-by-its-name.md b/dotnet-desktop-guide/wpf/advanced/how-to-find-an-element-by-its-name.md index d1968a1ed1..027c69f82e 100644 --- a/dotnet-desktop-guide/wpf/advanced/how-to-find-an-element-by-its-name.md +++ b/dotnet-desktop-guide/wpf/advanced/how-to-find-an-element-by-its-name.md @@ -21,3 +21,6 @@ In this example, the method to find a particular element by its name is written [!code-csharp[FEFindName#Find](~/samples/snippets/csharp/VS_Snippets_Wpf/FEFindName/CSharp/default.xaml.cs#find)] [!code-vb[FEFindName#Find](~/samples/snippets/visualbasic/VS_Snippets_Wpf/FEFindName/VisualBasic/default.xaml.vb#find)] + +> [!NOTE] +> The method only finds elements that are part of the XAML namescope. If you add an element to the object tree programmatically after XAML is loaded, the element's `Name` or `x:Name` value doesn't automatically register in the XAML namescope. To make a dynamically added element findable by name, call on the XAML namescope (typically the page or window root) before adding the element to the parent container. For more information, see [XAML Namescopes](wpf-xaml-namescopes.md).