# Other .NET Programming > Windows Presentation Foundation (WPF) & XAML forum >  From XAML GUI design to Powershell -> button

## melanied

Button is recognized but i'm unable to test an action on it. Anybody could help ?



[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
$XAML = [xml](Get-Content -Path "$PSScriptRoot\Design_MD4.xaml" ) #Change THIS Parameter to point to your file
#Read XAML (Parse it)
$reader=(New-Object System.Xml.XmlNodeReader $XAML)
#PrequisiteErrors
try{$Form=[Windows.Markup.XamlReader]::Load( $reader )}
catch{Write-Host "Unable to load Windows.Markup.XamlReader. Some possible causes for this problem include: .NET Framework is missing PowerShell must be launched with PowerShell -sta, invalid XAML code was encountered."; exit}

$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Window=[Windows.Markup.XamlReader]::Load( $reader )

#Connect to Controls
$BTNcreation = $Window.FindName('BTNcreation') 

$BTNcreation.add_click({write-host $hello})

#Displays the Window
$Form.ShowDialog() | out-null

----------

