Пример #1
0
        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();
                    }
                }
            }
        }
Пример #2
0
 protected override void OnParentChanged(ILayoutContainer oldValue, ILayoutContainer newValue)
 {
     if (this.IsSelected && base.Parent != null && base.Parent is ILayoutContentSelector)
     {
         ILayoutContentSelector parent = base.Parent as ILayoutContentSelector;
         parent.SelectedContentIndex = parent.IndexOf(this);
     }
     base.OnParentChanged(oldValue, newValue);
 }
Пример #3
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            Size desiredSize;
            IEnumerable <UIElement> uIElements = base.Children.Cast <UIElement>();
            double right = 0;
            bool   flag  = false;

            using (IEnumerator <UIElement> enumerator = (
                       from ch in uIElements
                       where ch.Visibility != System.Windows.Visibility.Collapsed
                       select ch).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TabItem       current = (TabItem)enumerator.Current;
                    LayoutContent content = current.Content as LayoutContent;
                    if (!flag)
                    {
                        desiredSize = current.DesiredSize;
                        if (right + desiredSize.Width <= finalSize.Width)
                        {
                            current.Visibility = System.Windows.Visibility.Visible;
                            Size size = current.DesiredSize;
                            current.Arrange(new Rect(right, 0, size.Width, finalSize.Height));
                            double    actualWidth = current.ActualWidth;
                            Thickness margin      = current.Margin;
                            double    left        = actualWidth + margin.Left;
                            margin = current.Margin;
                            right  = right + (left + margin.Right);
                            continue;
                        }
                    }
                    if (content.IsSelected && !current.IsVisible)
                    {
                        ILayoutContainer       parent = content.Parent;
                        ILayoutContentSelector layoutContentSelector = content.Parent as ILayoutContentSelector;
                        ILayoutPane            layoutPane            = content.Parent as ILayoutPane;
                        int num = layoutContentSelector.IndexOf(content);
                        if (num > 0 && parent.ChildrenCount > 1)
                        {
                            layoutPane.MoveChild(num, 0);
                            layoutContentSelector.SelectedContentIndex = 0;
                            desiredSize = this.ArrangeOverride(finalSize);
                            return(desiredSize);
                        }
                    }
                    current.Visibility = System.Windows.Visibility.Hidden;
                    flag = true;
                }
                return(finalSize);
            }
            return(desiredSize);
        }