问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/6145994/updatesourcetrigger-propertychanged-in-silverlight