Get a named item value in a XAML with PowerShell

Hello,

I came up with the same idear from my previous post??but to get informations back from the named item.

Function Get-ControlValue {
?? ?? [CmdletBinding()]
    Param(
        [String]$Control,
        [Object]$Window = $Window
    )
    switch ($Window.$Control.GetType().Name) {
        'TextBox' {
            $Value = $Window.$Control.Text
        }
        'ComboBox' {
            $Value = $Window.$Control.SelectedItem
        }
        'Button' {
            $Value = $Window.$Control.Content
        }
    }
    Write-Output $Value
}
Leave a Reply

Your email address will not be published. Required fields are marked *