protected LayoutAnchorable _ShowContent(object obj) { LayoutAnchorable a = new LayoutAnchorable(); if (obj is IPlatformClass) { IPlatformClass pc = (IPlatformClass)obj; if (pc.Vertex.Get(@"BaseEdge:\To:") != null && pc.Vertex.Get(@"BaseEdge:\To:").Value != null && (!GeneralUtil.CompareStrings(pc.Vertex.Get(@"BaseEdge:\To:").Value, ""))) { a.Title = pc.Vertex.Get(@"BaseEdge:\To:").Value.ToString(); } else { a.Title = (string)pc.Vertex.Value; } PlatformClassSimpleWrapper pcsw = new PlatformClassSimpleWrapper(); pcsw.SetContent(pc); a.Content = pcsw; a.IsVisibleChanged += pcsw.HideEventHandler; //a.Closing +=pcsw.ClosedEventHandler; a.Closed += pcsw.ClosedEventHandler; // not work - to focus //System.Windows.Input.Keyboard.Focus((IInputElement)pc); this.Pane.Children.Add(a); pcsw.IsIntialising = true; a.Hide(); // this works a.Show(); // for getting focus pcsw.IsIntialising = false; } else { a.Title = obj.ToString(); a.Content = obj; this.Pane.Children.Add(a); a.Hide(); // this works a.Show(); // for getting focus } //a.AddToLayout(this.dockingManager, AnchorableShowStrategy.Most); // maybe for later use return(a); }
private void SetPropertyWindowVisibility(bool isVisible, LayoutAnchorable window, LayoutAnchorablePane container) { if (isVisible && window.Parent == null) { if (propertyWindowGroup.Parent == null) { windowPanel.Children.Insert(0, propertyWindowGroup); } if (window == taskPanel) { propertyWindowGroup.Children.Insert(0, container); } else { propertyWindowGroup.Children.Add(container); } container.Children.Add(window); window.Show(); } else if (!isVisible && window.Parent != null) { window.Close(); } }
void _application_OnShowDockableWindow(IDockableWindow window) { if (!_anchorables.ContainsKey(window)) return; LayoutAnchorable anchorable = _anchorables[window]; if (anchorable != null) { if (anchorable.IsAutoHidden) { anchorable.ToggleAutoHide(); } else { LayoutContent content = anchorable; while (content != null && content.Parent is ILayoutContentSelector) { ILayoutContentSelector selector = (ILayoutContentSelector)content.Parent; int index = selector.IndexOf(content); if (index != selector.SelectedContentIndex) selector.SelectedContentIndex = index; content = content.Parent as LayoutContent; } anchorable.Show(); if (anchorable.IsVisible == false) { //if (anchorable.CanFloat) // anchorable.Float(); //else anchorable.Dock(); } } } }
/// <summary> /// Cleanly show a hidden Anchorable. /// </summary> /// <param name="dockingManager">The Root item DockingManager.</param> /// <param name="content">Either a View, ViewModel or <see cref="Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable"/> /// contained in the layout of the DockingManager as an Anchorable.</param> /// <param name="setAsActiveContent">Set the content as the Active Content of the DockingManager when shown.</param> /// <returns>True is successfully shown, otherwise false.</returns> public static bool ShowAnchorable(this DockingManager dockingManager, object content, bool setAsActiveContent) { if (dockingManager == null) { throw new ArgumentNullException(nameof(dockingManager)); } if (content == null) { return(true); } LayoutAnchorable anchorable = dockingManager.FindAnchorable(content); if (anchorable == null) { return(false); } if (anchorable.IsHidden || dockingManager.IsActuallyHidden(anchorable)) { anchorable.Show(); } if (setAsActiveContent && dockingManager.ActiveContent != anchorable) { dockingManager.ActiveContent = anchorable; } return(!dockingManager.IsActuallyHidden(anchorable)); }
/// <summary> /// Provides derived classes an opportunity to handle changes to the IsHidden property. /// </summary> protected virtual void OnIsHiddenChanged(DependencyPropertyChangedEventArgs e) { if (_anchorable != null) { if (_anchorable.IsHidden != (bool)e.NewValue) { if (_anchorable.IsHidden) { _anchorable.Show(); } else { _anchorable.Hide(); } } } }
private static void ToggleVisible(LayoutAnchorable Anchorable) { if (Anchorable.IsVisible) { Anchorable.Hide(); } else { Anchorable.Show(); } }
private static void SetToolPaneProperties(LayoutAnchorable anchorableToShow) { anchorableToShow.Show(); anchorableToShow.ToggleAutoHide(); var toolpanel = anchorableToShow.Content as Viewer.AdvancedTypes.DockingToolHelper.ToolViewModel; var layoutPane = anchorableToShow.Parent as LayoutAnchorablePane; layoutPane.DockMinWidth = toolpanel.MinWidth; layoutPane.DockMinHeight = toolpanel.MinHeight; }
public void ClearBindingOfHiddenWindowTest() { LayoutAnchorable layoutAnchorable = new LayoutAnchorable { FloatingWidth = 50, FloatingHeight = 100, ContentId = "Test" }; LayoutAnchorablePane layoutAnchorablePane = new LayoutAnchorablePane(layoutAnchorable); LayoutAnchorablePaneGroup layoutAnchorablePaneGroup = new LayoutAnchorablePaneGroup(layoutAnchorablePane); LayoutAnchorableFloatingWindow layoutFloatingWindow = new LayoutAnchorableFloatingWindow { RootPanel = layoutAnchorablePaneGroup }; var ctor = typeof(LayoutAnchorableFloatingWindowControl) .GetTypeInfo() .GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance) .First(x => x.GetParameters().Length == 1); LayoutAnchorableFloatingWindowControl floatingWindowControl = ctor.Invoke(new object[] { layoutFloatingWindow }) as LayoutAnchorableFloatingWindowControl; floatingWindowControl.SetBinding( UIElement.VisibilityProperty, new Binding("IsVisible") { Source = floatingWindowControl.Model, Converter = new BoolToVisibilityConverter(), Mode = BindingMode.OneWay, ConverterParameter = Visibility.Hidden }); BindingExpression visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNotNull(visibilityBinding); layoutAnchorable.Show(); layoutAnchorable.Hide(); visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNotNull(visibilityBinding); floatingWindowControl.Hide(); visibilityBinding = floatingWindowControl.GetBindingExpression(UIElement.VisibilityProperty); Assert.IsNull(visibilityBinding); }
private void ShowHideCamera(object sender, PropertyChangedEventArgs e) { //MIGHT NEED TO USE THIS CODE IN CASE IT CRASHES SAYING ITS TRYING TO ACCES FROM ANOTHER THREAD if (!this.Dispatcher.HasShutdownStarted && !this.Dispatcher.HasShutdownFinished) { this.Dispatcher.Invoke((Action)(() => { if (e.PropertyName == "IsActive") { LayoutAnchorable camLayoutAnch = null; var cvm = sender as CameraViewModel; var mainVM = DataContext as MainViewModel; if (cvm == mainVM.VMCamera1) { camLayoutAnch = this.LayoutCam1; } else if (cvm == mainVM.VMCamera2) { camLayoutAnch = this.LayoutCam2; } else if (cvm == mainVM.VMCamera3) { camLayoutAnch = this.LayoutCam3; } if (cvm.IsActive) { camLayoutAnch.Show(); } else if (!isAlreadyHidingCamLayout) { //We dont want to try and hide if it was already hidden through the GUI camLayoutAnch.Hide(); } else { //Reset for next time isAlreadyHidingCamLayout = false; } } })); } }
public void SetVisibility(LayoutAnchorable anchorable, bool visibility) { anchorable.AssertNotNull(nameof(anchorable)); try { if (visibility) { LayoutGroups[anchorable].Children.Add(anchorable); anchorable.Show(); LayoutGroups[anchorable].SelectedContentIndex = LayoutGroups[anchorable].Children.IndexOf(anchorable); } else { UpdateContainer(anchorable); anchorable.Hide(); } } catch { // Due to serializing/deserializing the application multiple times, a reference an an anchorable/an anchorable's parent might be lost. // If that's the case, we refresh the view and add it in the first available pane. if (DockingView != null && DockingView.DockingManager != null) { var root = DockingView.DockingManager.Layout; var availablePane = root.IfNotNull(o => o.Descendents().ExcludeDefaultValues().OfType <LayoutAnchorablePane>().FirstOrDefault()); if (availablePane != null) { if (LayoutGroups.ContainsKey(anchorable)) { LayoutGroups[anchorable] = availablePane; } else { LayoutGroups.Add(anchorable, availablePane); } LayoutGroups[anchorable].Children.Add(anchorable); LayoutGroups[anchorable].SelectedContentIndex = LayoutGroups[anchorable].Children.IndexOf(anchorable); } } // Do nothing. If this point is reached, it means the layout anchorable has not been loaded yet in the UI. // This can happen due to various UI events triggering by the initialization of viewModel components(MainMenuViewModel for example). } }
/// <summary> /// Show an anchorable, if not already visible /// </summary> /// <param name="ContentId">The contendID of the anchorable to be made visible</param> private void ShowAnchorable(string ContentId) { if (MainWindow.GetInstance() == null) { return; } foreach (ILayoutElement le in MainWindow.GetInstance().GetDockingManager().Layout.Children) { if (le is LayoutAnchorable) { LayoutAnchorable la = le as LayoutAnchorable; if (la.ContentId == ContentId) { la.Show(); return; } } } }
protected override void OnVisibilityChanged() { if (_anchorable?.Root != null) { if (_visibilityReentrantFlag.CanEnter) { using (_visibilityReentrantFlag.Enter()) { if (Visibility == Visibility.Hidden) { _anchorable.Hide(false); } else if (Visibility == Visibility.Visible) { _anchorable.Show(); } } } } base.OnVisibilityChanged(); }
/// <summary> /// Makes the editor pane active and visible. /// </summary> /// <param name="editorPane"></param> private static void MakeActiveVisible([NotNull] LayoutAnchorable editorPane) { editorPane.IsActive = true; editorPane.Show(); }
public override void Undo() { _anchorable.Show(); //((ISiteViewModelReceiver)Receiver).__ShowPane(_pane); }
private void OpenPane(LayoutAnchorable pane) { Logger.Info($"Layout {pane.Title} opened"); pane.Show(); pane.IsSelected = true; }