开发者

Binding Events that are Unknown

I have a WPF Listbox filled with children that fire events.

Now, I am dynamically loading each of the children but I want to hook up the events to a handler. Basically, each time one of the children give me a notificationEvent(Notification n), I want to add the Notification (n) to an observable co开发者_StackOverflowllection.

How would I do this so that no matter the amount of children, I can load all the events into the observable collection.

Also, how would you do this in MVVM?

EDIT: All I want to do is simply add all the Notifications that the children gives me to an observable collection.


Using MVVM, I would expose an ICommand as a property and would then bind the CommandParameter with the list item's bound object. You can check Prism's DelegateCommand for an implementation of an ICommand which receives a delegate to be called on the Execute() method invocation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜