and DocList is a list of viewmodel for controls:TextEditorEx, when click close btn of tab , certain vm will be removed from DocList.
it works fine until i bind Options to VM,when VM is removed from DocList, it triggers OptionsChanged Event and throws “Object reference not set to an instance of an object”.
I'm new to MVVM and WPF so how can I fix this problem? It seems to me the View Model should be destruct AFTER control does.
I'm working on a notepadplus-like editor with avalonEdit. I made a control class based on avalonedit and put it in a tab control template like this:
and DocList is a list of viewmodel for controls:TextEditorEx, when click close btn of tab , certain vm will be removed from DocList. it works fine until i bind Options to VM,when VM is removed from DocList, it triggers OptionsChanged Event and throws “Object reference not set to an instance of an object”.
I'm new to MVVM and WPF so how can I fix this problem? It seems to me the View Model should be destruct AFTER control does.