I\'m running into an unusual problem in my unit tests. The class I\'m testing creates a dependency property dynamically at runtime and the type of that dependency property c
Had an issue with a ContentPresenter with different Datatemplates where one of them had a DependencyProperty with a PropertyChangedCallback When changing ContentPresenters content to another DataTemplate the callback remained.
In the UserControls Unloaded event i called:
BindingOperations.ClearAllBindings(this);
Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate { return null; }), null);
That worked for me