protected override void OnDetaching() { editorVm = null; if (editor != null) { editor.DataContextChanged -= Editor_DataContextChanged; editor = null; } base.OnDetaching(); }