Scenario: A VB6 library calls a method in a .NET-Assembly through COM and with that opens a WPF-Dialog, which is contained in another .NET-Assembly that is early bound. This WPF-Dialog got a complex master/detail implementation over a DependencyProperty of type ObservableCollection on this dialog. The DependencyProperty looks something like this:
public static readonly DependencyProperty ThatDependencyPropertyProperty =
DependencyProperty.Register("ThatDependencyProperty", typeof(ObservableCollection<SomeClass>)
, typeof(MainWindow), new UIPropertyMetadata(new ObservableCollection<SomeClass>()));
Problem: After this dialog gets closed through setting DialogResult and is being completely re-instantiated, this DependecyProperty still got it's values and the dialog is still displaying the previous master/detail information. My current workaround is to simply let the dialog clear the collection in it's ctor, but I certainly don't like this... what could keep this collection alive through two instantiations?