/// <summary> /// Add a panel dynamically over the panel currently shown. /// </summary> /// <remarks> /// This method allows to create a stack of panels in way to navigate on the panels in a similar manner on the web page browsing. /// </remarks> /// <param name="panel">The panel to add.</param> internal void AddPanel(Panels.UIPanel panel) { Contract.Requires(panel != null); panels[_lastCheckedButton].Visibility = Visibility.Hidden; if (_dynamicPanelsStack.Count == 0) panels[_lastCheckedButton].Close(); else _dynamicPanelsStack.Peek().Close(); _lastCheckedButton.IsChecked = false; ContentGrid.Children.Add(panel); _dynamicPanelsStack.Push(panel); panel.Open(); DynamicToolbar.Visibility = Visibility.Visible; }