WPF 和 Powershell - 处理事件 [英] WPF and Powershell - Handling events

查看:73
本文介绍了WPF 和 Powershell - 处理事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能为我指明一些有关在 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 - 处理事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆