Known Issue: VSM/DatePicker Memory Leak
NOTE: This issue has been fixed in the January 2009 Release of the WPF Toolkit.
There is a memory leak in VisualStateManager caused by the attached VisualStateBehaviors which arises whenever a call is made to VisualStateBehaviors.AddValueChanged. This leak manifests itself in the DatePicker control and we do not recommend shipping the DatePicker in production code unless this issue is fixed
. The WPF team is currently working on a fix for this issue and will release that fix as soon as possible.
In the meantime, if you need to ship the DatePicker prior to the release of the official fix, there are some steps you can take to implement a workaround to prevent calls to VisualStateBehaviors.AddValueChanged. All of the behaviors which ship with the Toolkit make this call in their OnAttach method, therefore, a workaround must either prevent the stock behaviors from loading, or prevent them from calling OnAttach. VisualStateBehaviorsFactory controls the automatic loading of stock behaviors as long as the VisualStateBehavior property has the default value. A workaround could prevent the automatic loading of stock behaviors by setting this property. However, a new behavior would have to be set, and that behavior would need to implement its own way of listening to property change events. In addition, behaviors for ButtonBase, ToggleButton, ListBox, and ProgressBar would need to be provided.
The workaround is fairly complicated and would require a good deal of work, so our recommendation is for developers to wait for the official fix if at all possible. Please note that this issue will not be present in the .NET 4.0 version of these components, since VisualStateBehaviors will not be included in the final version of VSM.