Disable a named item in XAML with PowerShell

Hello, Here is a function I wrote for my current script, to create user in Active Direcotry with a GUI in XAML, and which will disable a named item in the XAML. Function Disable-NamedItem { [CmdletBinding()] Param( [String[]]$Item, [Object]$Window = $Window ) foreach ($object in $Item) { $Window.$object.IsEnabled = $false } }