首页 > 解决方案 > Powershell WPF PerformClick() 错误

问题描述

$Window.Add_KeyDown({ 
 
    if ($args[1].key -eq 'Enter'){
    
    $syncHash.GEL.Value.PerformClick() #button
    
 }
})

#error
Method invocation failed because [System.Windows.Controls.Button] does not contain a method named 'PerformClick'.
:171 char:5
+     $syncHash.GEL.Value.PerformClick()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

标签: wpfpowershell

解决方案


推荐阅读