Content

6/09/2011

MVVM Light for Windows Phone EventToCommand Memory Leak

When you use EventToCommand like this, be careful!

<Button>
  <i:EventTrigger EventName="Click">
     <mvvmLight:EventToCommand Command="{Binding MyCommand "/>
  </i:EventTrigger>
</Button>

The memory usage will be growing up.
The Attach of the DependencyObject is working fine, but the detach will never called. That causes severe memory issues.
It's a known issue on codeplex:
http://mvvmlight.codeplex.com/workitem/7293
http://mvvmlight.codeplex.com/workitem/7512

We tried to find good ways to detach our event handler. But to remove the EventToCommand stuff was much easier than any workaround we found.

No comments:

Post a Comment