What's a good implementation of weak events for silverlight?

854 views Asked by At

I'm after a good implementation of the weak event patterns for Silverlight to avoid memory leaks. There seem to be a few implementations out there but the code is not trivial and it's hard to know which one is correct. I can't find any official recommendation from Microsoft.

I'm after a simple syntax if possible.

Cheers.

1

There are 1 answers

3
AnthonyWJones On BEST ANSWER

Install a copy of the Silverlight Toolkit which comes with source code zipped up. In there you will find the pattern of weak events that you might consider the "Microsoft" recommendation. (You can also fetch the latest source from codeplex).

The implementation you are after is WeakEventListener found in the Common folder of he main Controls.Toolkit project.