Silverlight 中的 UpdateSourceTrigger PropertyChanged?

发布于 2024-11-10 03:35:28 字数 242 浏览 0 评论 0原文

我相信大多数人都遇到过这种情况,当您在文本框中输入您想要立即根据输入的内容过滤 ViewCollection 时。

它在 WPF 中非常简单,只需将 Text 绑定的 UpdateSourceTrigger 更改为 PropertyChanged 即可。

正如您所料,Silverlight 没有它。只有默认的和显式的。

我的想法是将交互行为绑定到文本框的 TextChanged 事件。您会推荐这种方法还是有更好的方法?

I am sure most of you have come across this when you type in a textbox you like instantly to filter a ViewCollection according to has been typed.

Its very straight forward in WPF, just change the UpdateSourceTrigger for Text binding to PropertyChanged.

As you would expect Silverlight doesnt have it. There is just a default and explicit instead.

I had the idea to bind an Interaction behavior to TextChanged event of the textbox instead. Would you recommend this approach or is there a better way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朱染 2024-11-17 03:35:28

行为是我团队解决问题的方式,我认为这是普遍接受的方法。我还看到过使用 Attached Properties 解决该问题的文章(可能是更简洁的 XAML 语法,但我从未尝试过)。这些是出现的第一个链接,完全未经我测试(应该很容易找到其他链接):

行为

附加属性

A behavior is the way it was solved on my team, and I think is the generally accepted method. I have also seen articles solving it with Attached Properties (might be cleaner XAML syntax, but I have never tried it). These are the first links that came up, completely untested by me (should be easy enough to find others):

Behavior

Attached Property

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文