Looping through controls in WPF / Powershell
问题 I am trying to loop through some controls in a Powershell / WPF application. Nothing fancy, just setting some text on a mouseEnter event. It works fine if I don't loop the code: $reader = New-Object System.Xml.XmlNodeReader $xaml $d = [Windows.Markup.XamlReader]::Load($reader) $d.FindName("GridOne").add_mouseEnter({ $d.FindName("HelpText").Content = "One" }) $d.FindName("GridTwo").add_mouseEnter({ $d.FindName("HelpText").Content = "Two" }) $d.FindName("GridThree").add_mouseEnter({ $d.FindName