private void DetachVisibilityHandler(WindowCommandsItem container) { if (container != null) { container.VisibilityPropertyChangeNotifier = null; } }
private void AttachVisibilityHandler(WindowCommandsItem container, UIElement item) { if (container != null) { // hide the container, if there is no UIElement if (null == item) { container.Visibility = Visibility.Collapsed; return; } container.Visibility = item.Visibility; var isVisibilityNotifier = new PropertyChangeNotifier(item, UIElement.VisibilityProperty); isVisibilityNotifier.ValueChanged += VisibilityPropertyChanged; container.VisibilityPropertyChangeNotifier = isVisibilityNotifier; } }