Silverlight 中的 UpdateSourceTrigger PropertyChanged?
我相信大多数人都遇到过这种情况,当您在文本框中输入您想要立即根据输入的内容过滤 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
行为是我团队解决问题的方式,我认为这是普遍接受的方法。我还看到过使用 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