Fixes memory leak in ItemsControlAnimationBehavior
Refactors the code.