/// <summary>
        /// Replaces an instant visualization placeholder panel with an instant visualization panel.
        /// </summary>
        /// <param name="oldPanel">The visualization panel to replace.</param>
        /// <param name="newPanel">The visualization panel to replace it with.</param>
        public void ReplaceChildVisualizationPanel(VisualizationPanel oldPanel, VisualizationPanel newPanel)
        {
            if (oldPanel == null)
            {
                throw new ArgumentNullException(nameof(oldPanel));
            }

            if (newPanel == null)
            {
                throw new ArgumentNullException(nameof(newPanel));
            }

            // Make sure the placeholder panel being replaced is really a child of this container
            int placeholderPanelIndex = this.Panels.IndexOf(oldPanel);

            if (placeholderPanelIndex < 0)
            {
                throw new ArgumentException("placeholderPanel is not a member of the Panels collection");
            }

            // Disconnect the placeholder panel
            oldPanel.PropertyChanged -= this.ChildVisualizationPanel_PropertyChanged;
            oldPanel.SetParentContainer(null);

            // Wire up the new panel
            newPanel.SetParentContainer(this.Container);
            newPanel.ParentPanel      = this;
            newPanel.Width            = oldPanel.Width;
            newPanel.PropertyChanged += this.ChildVisualizationPanel_PropertyChanged;

            // Replace the panel
            this.Panels[placeholderPanelIndex] = newPanel;
            this.UpdateChildPanelMargins();
        }
        private void AddChildVisualizationPanel(Type visualizationPanelType)
        {
            VisualizationPanel panel = Activator.CreateInstance(visualizationPanelType) as VisualizationPanel;

            panel.SetParentContainer(this.Container);
            panel.ParentPanel = this;
            this.panels.Add(panel);
            panel.PropertyChanged += this.ChildVisualizationPanel_PropertyChanged;
            this.Cells             = this.Panels.Count;
        }
Esempio n. 3
0
        /// <summary>
        /// Replaces an instant visualization placeholder panel with an instant visualization panel.
        /// </summary>
        /// <param name="oldPanel">The visualization panel to replace.</param>
        /// <param name="newPanel">The visualization panel to replace it with.</param>
        public void ReplaceChildVisualizationPanel(VisualizationPanel oldPanel, VisualizationPanel newPanel)
        {
            if (oldPanel == null)
            {
                throw new ArgumentNullException(nameof(oldPanel));
            }

            if (newPanel == null)
            {
                throw new ArgumentNullException(nameof(newPanel));
            }

            // Make sure the placeholder panel being replaced is really a child of this container
            int placeholderPanelIndex = this.Panels.IndexOf(oldPanel);

            if (placeholderPanelIndex < 0)
            {
                throw new ArgumentException("placeholderPanel is not a member of the Panels collection");
            }

            // Disconnect the placeholder panel
            oldPanel.PropertyChanged -= this.ChildVisualizationPanel_PropertyChanged;
            oldPanel.SetParentContainer(null);

            // Wire up the new panel
            newPanel.SetParentContainer(this.Container);
            newPanel.ParentPanel      = this;
            newPanel.Width            = oldPanel.Width;
            newPanel.PropertyChanged += this.ChildVisualizationPanel_PropertyChanged;

            // Replace the panel
            this.Panels[placeholderPanelIndex] = newPanel;
            this.UpdateChildPanelMargins();

            // If the current visualization panel is the one we just replaced,
            // then set it instead to the new panel we replaced it with.
            if (this.Container?.CurrentPanel == oldPanel)
            {
                newPanel.IsTreeNodeSelected = true;
            }
        }