WPF C#

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="WpfApplication1.FEFindName">
  
      
        
        
        
      
      
        
        
      
  

  Find element with the ID "dog" and change color
  
    Cat
    Dog
    Fish    
  

//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace WpfApplication1
{
    public partial class FEFindName {
        void Find(object sender, RoutedEventArgs e)
        {
            object wantedNode = stackPanel.FindName("dog");
            if (wantedNode is TextBlock)
            {
                TextBlock wantedChild = wantedNode as TextBlock;
                wantedChild.Foreground = Brushes.Blue;
            }
        }
    }
}