-
November 12th, 2020, 02:35 PM
#1
From XAML GUI design to Powershell -> button
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|