Recommended

Skip Navigation LinksHome / Articles / View Article

WeakEventSource Implementation

+ Add to SilverlightShow Favorites
0 comments   /   posted by Beat Kiener on Feb 19, 2010
(0 votes)
Tags: WeakEvent , Patterns , MVVM

Beat Kiener implemented a WeakEventSource wrapper to simplify custom control development.

When implementing custom controls you should fully support the Silverlight content model to get the controls bindable with the MVVM pattern. Responding to CollectionChanged events provided by INotifyCollectionChanged interface should be considered too. But when attaching just the necessary events you can get into a serious memory leaking problem. The WeakEventSource implementation is a weak-event-pattern implementation based on the WeakEventListener. The class is helping us to reduce writing tedious code in custom control de-velopment, reduces memory leaks which are hard to find and last but not least it is easier to review custom control written that way, because a Reviewer must not have full knowledge of the weak-event pattern.

Share


Comments

Comments RSS RSS
No comments

Add Comment

 
 

   
  
  
   
Please add 2 and 7 and type the answer here:

Join the free SilverlightShow webinar 'Silverlight's Power Features: Data Binding in Action' on August 19th 2010, 10:00 am PDT.
In this session Gill Cleeren will make with a complete overview of the data binding features Silverlight 4 has to offer. He will discuss how data binding is the enabler for applying the MVVM pattern and commanding, and will end up reviewing Blend's support for data binding, including the use of design-time data. Read more | Register Now (hide this)