public override void Detach(IDockElement element) { base.Detach(element); //保存Size信息 if (_view != null) { (element as DockElement).DesiredHeight = (_view as BaseGroupControl).ActualHeight; (element as DockElement).DesiredWidth = (_view as BaseGroupControl).ActualWidth; //如果Children_CanSelect数量为0,且Container不是LayoutDocumentGroup,则尝试将view从界面移除 if (Children_CanSelect.Count() == 0) //如果Children_CanSelect数量为0 { _DetachFromParent(); } } }
public override void Detach(IDockElement element) { base.Detach(element); //保存Size信息 if (_view != null) { var bgc = _view as BaseGroupControl; if (bgc.IsInitialized && bgc.ActualHeight >= Constants.SideLength && bgc.ActualWidth >= Constants.SideLength) { (element as DockElement).DesiredHeight = bgc.ActualHeight; (element as DockElement).DesiredWidth = bgc.ActualWidth; } //如果Children_CanSelect数量为0,且Container不是LayoutDocumentGroup,则尝试将view从界面移除 if (Children_CanSelect.Count() == 0) //如果Children_CanSelect数量为0 { _DetachFromParent(); } } }
protected override void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnChildrenPropertyChanged(sender, e); if (e.PropertyName == "CanSelect") { if (_view == null) { return; } if ((sender as DockElement).CanSelect) { (_view as TabControl).SelectedIndex = Children_CanSelect.Count() - 1; } else { (_view as TabControl).SelectedIndex = Children_CanSelect.Count() > 0 ? 0 : -1; } if (Children_CanSelect.Count() == 0) { _DetachFromParent(); } } }