Silverlight listbox validation: required selection
I want to validate a ListBox: the user must select at least 2 items. The SelectedI开发者_StackOverflow中文版tems property doesn't support binding. So what now?
I miss the good old days when WinForms and ASP.NET controls had validation events, buttons had the CausesValidation property, etc...
You could probably handle the selected items changed event using a Trigger or Behaviour and then use the INotifyDataErrorInfo to create a validation errors for that control.
http://www.silverlightshow.net/items/Behaviors-and-Triggers-in-Silverlight-3.aspx
http://attachedwpf.com/blog/2010/03/24/silverlight-4-inotifydataerrorinfo/
精彩评论