private void DockingManagerContentHidingEventHandler(Content c, CancelEventArgs cea) { // this event is fired when the X on the shelf is clicked var shelfView = (ShelfView)c.Tag; // don't let dotnetmagic remove the shelf cea.Cancel = true; shelfView.RaiseCloseRequested(); }