protected override void OnClosed(EventArgs e)
        {
            var root = Model.Root;

            root.Manager.RemoveFloatingWindow(this);
            root.CollectGarbage();
            if (_overlayWindow != null)
            {
                _overlayWindow.Close();
                _overlayWindow = null;
            }

            base.OnClosed(e);

            if (!CloseInitiatedByUser)
            {
                root.FloatingWindows.Remove(_model);
            }

            _model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged);
        }
Esempio n. 2
0
        protected override void OnClosed(EventArgs e)
        {
            var root = Model.Root;

            if (root != null)
            {
                LayoutRoot layoutRoot = root as LayoutRoot;
                if (layoutRoot != null)
                {
                    layoutRoot.Updated -= OnRootUpdated;
                }

                root.Manager.RemoveFloatingWindow(this);
                root.CollectGarbage();
            }
            if (_overlayWindow != null)
            {
                _overlayWindow.Close();
                _overlayWindow = null;
            }

            base.OnClosed(e);

            if (!CloseInitiatedByUser && (root != null))
            {
                root.FloatingWindows.Remove(_model);
            }

            // We have to clear binding instead of creating a new empty binding.
            BindingOperations.ClearBinding(_model, VisibilityProperty);

            _model.PropertyChanged  -= new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged);
            _model.IsVisibleChanged -= _model_IsVisibleChanged;
            Activated        -= LayoutAnchorableFloatingWindowControl_Activated;
            IsVisibleChanged -= this.LayoutAnchorableFloatingWindowControl_IsVisibleChanged;
            BindingOperations.ClearBinding(this, VisibilityProperty);
            BindingOperations.ClearBinding(this, SingleContentLayoutItemProperty);
        }