问题描述
谁能为我指明一些有关在 Powershell 中处理 WPF UI 事件的文档的正确方向?
Can anyone point me in the right direction for some documentation about handling WPF UI events in Powershell?
例如,我想知道如何在 CheckBox 或 Radio Button 更改时调用函数.
I want to know how to, for example, call a function when a CheckBox or Radio Button is changed.
干杯!
本
推荐答案
考虑到 WPF 和 PowerShell,请查看 WPF Linkcollection for PowerShell 来自 Bernd.您会发现许多对您有所帮助的有趣链接.
Considering WPF and PowerShell, have a look at WPF Linkcollection for PowerShell from Bernd. You will find many interesting links that will help you.
考虑到您的问题,只需使用模式
Considering your problem, just use pattern
$control.Add_<someevent>({ what to do })
例如,someevent
可以是 点击
按钮:
For example, someevent
could be Click
for a Button:
$button.Add_Click({ $global:clicked = $true })
您传入处理事件的脚本块.
You pass in a scriptblock that handles the event.
这篇关于WPF 和 Powershell - 处理事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!