public bool RemoveControl(ITabControlContainer sender, FrameworkElement controlToInsertInPlaceOfRemoved)
        {
            var v = this.Parent;

            gridContentSplitControl.Children.Remove(itccCenter as UIElement);
            itccCenter = null;
            if (controlToInsertInPlaceOfRemoved is ITabControlContainer)
            {
                itccCenter = controlToInsertInPlaceOfRemoved as ITabControlContainer;
                gridContentSplitControl.Children.Insert(0, itccCenter as UIElement);
                Grid.SetRow(itccCenter as UIElement, 0);
            }
            else if (controlToInsertInPlaceOfRemoved is TearableTabControl)
            {
                gridContentSplitControl.Children.Remove(sender as UIElement);
                ttddMain.Visibility = Visibility.Visible;
                ttddMain.AttachDetectorElement(controlToInsertInPlaceOfRemoved);
                ttcMain = controlToInsertInPlaceOfRemoved as TearableTabControl;
                if (ttcMain.Parent != null)
                {
                    (ttcMain.Parent as Grid).Children.Remove(ttcMain);
                }
                gridContentSplitControl.Children.Insert(0, ttcMain);
                //gridContent.Children.Insert(0, controlToInsertInPlaceOfRemoved as UIElement);
            }
            return(true);
        }
 public void Remove(ref ITabControlContainer itcc, ref TearableTabControl ttc, ref TearableTabDropDetector ttdd, TearableTabControl ttcToBeInserted, int insertIndex)
 {
     gridContentVertical.Children.Remove(itcc as UIElement);
     itcc = null;
     ttc  = ttcToBeInserted;
     AttachHandlers(ttc);
     ttdd.Visibility = Visibility.Visible;
     ttdd.AttachDetectorElement(ttc);
     gridContentVertical.Children.Insert(0, ttc);
     Grid.SetColumn(ttc, insertIndex);
 }
 public bool RemoveControl(ITabControlContainer sender, FrameworkElement controlToInsertInPlaceOfRemoved)
 {
     if (sender == itccLeft)
     {
         gridContentVertical.Children.Remove(itccLeft as UIElement);
         itccLeft = null;
         if (controlToInsertInPlaceOfRemoved is ITabControlContainer)
         {
             itccLeft = controlToInsertInPlaceOfRemoved as ITabControlContainer;
             gridContentVertical.Children.Insert(0, itccLeft as UIElement);
             Grid.SetColumn(itccLeft as UIElement, 0);
         }
         else if (controlToInsertInPlaceOfRemoved is TearableTabControl)
         {
             ttcLeft = controlToInsertInPlaceOfRemoved as TearableTabControl;
             AttachHandlers(ttcLeft);
             ttddLeft.Visibility = Visibility.Visible;
             ttddLeft.AttachDetectorElement(ttcLeft);
             gridContentVertical.Children.Insert(0, ttcLeft);
             Grid.SetColumn(ttcLeft, 0);
         }
         //Remove(ref itccLeft, ref ttcLeft, ref ttddLeft, controlToInsertInPlaceOfRemoved, 0);
     }
     else if (sender == itccRight)
     {
         gridContentVertical.Children.Remove(itccRight as UIElement);
         itccRight = null;
         if (controlToInsertInPlaceOfRemoved is ITabControlContainer)
         {
             itccRight = controlToInsertInPlaceOfRemoved as ITabControlContainer;
             gridContentVertical.Children.Insert(0, itccRight as UIElement);
             Grid.SetColumn(itccRight as UIElement, 2);
         }
         else if (controlToInsertInPlaceOfRemoved is TearableTabControl)
         {
             ttcRight = controlToInsertInPlaceOfRemoved as TearableTabControl;
             AttachHandlers(ttcRight);
             ttddRight.Visibility = Visibility.Visible;
             ttddRight.AttachDetectorElement(ttcRight);
             gridContentVertical.Children.Insert(0, ttcRight);
             Grid.SetColumn(ttcRight, 2);
             //Remove(ref itccRight, ref ttcRight, ref ttddRight, controlToInsertInPlaceOfRemoved, 0);
         }
     }
     else
     {
         throw new NotSupportedException("Child contorl not found");
     }
     return(true);
 }
Example #4
0
 public bool RemoveControl(ITabControlContainer sender, FrameworkElement controlToInsertInPlaceOfRemoved)
 {
     if (sender == itccTop)
     {
         gridContentHorizontal.Children.Remove(itccTop as UIElement);
         itccTop = null;
         if (controlToInsertInPlaceOfRemoved is ITabControlContainer)
         {
             itccTop = controlToInsertInPlaceOfRemoved as ITabControlContainer;
             gridContentHorizontal.Children.Insert(0, itccTop as UIElement);
             Grid.SetRow(itccTop as UIElement, 0);
         }
         else if (controlToInsertInPlaceOfRemoved is TearableTabControl)
         {
             ttcTop = controlToInsertInPlaceOfRemoved as TearableTabControl;
             AttachHandlers(ttcTop);
             ttddTop.Visibility = Visibility.Visible;
             ttddTop.AttachDetectorElement(ttcTop);
             gridContentHorizontal.Children.Insert(0, ttcTop);
             Grid.SetRow(ttcTop, 0);
         }
         //Remove(ref itccTop, ref ttcTop, ref ttddTop, controlToInsertInPlaceOfRemoved, 0);
     }
     else if (sender == itccBottom)
     {
         gridContentHorizontal.Children.Remove(itccBottom as UIElement);
         itccBottom = null;
         if (controlToInsertInPlaceOfRemoved is ITabControlContainer)
         {
             itccBottom = controlToInsertInPlaceOfRemoved as ITabControlContainer;
             gridContentHorizontal.Children.Insert(0, itccBottom as UIElement);
             Grid.SetRow(itccBottom as UIElement, 2);
         }
         else if (controlToInsertInPlaceOfRemoved is TearableTabControl)
         {
             ttcBottom = controlToInsertInPlaceOfRemoved as TearableTabControl;
             AttachHandlers(ttcBottom);
             ttddBottom.Visibility = Visibility.Visible;
             ttddBottom.AttachDetectorElement(ttcBottom);
             gridContentHorizontal.Children.Insert(0, ttcBottom);
             Grid.SetRow(ttcBottom, 2);
             //Remove(ref itccBottom, ref ttcBottom, ref ttddBottom, controlToInsertInPlaceOfRemoved, 0);
         }
     }
     else
     {
         throw new NotSupportedException("Child contorl not found");
     }
     return(true);
 }
        private void TearableTabControl_ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            TearableTabControl ttc = sender as TearableTabControl;

            if (null != ttc)
            {
                if (0 == ttc.Items.Count)
                {
                    DetachHandlers(ttcLeft);
                    DetachHandlers(ttcRight);

                    ttddLeft.DetachDetectorElement();
                    ttddRight.DetachDetectorElement();

                    DetachHandlers(ttddLeft);
                    DetachHandlers(ttddRight);

                    if (ttc == ttcLeft)
                    {
                        ttcLeft = null;
                        if (null != ttcRight)
                        {
                            gridContentVertical.Children.Remove(ttcRight);
                            TabParent.RemoveControl(this, ttcRight);
                            ttcRight = null;
                        }
                        else if (null != itccRight)
                        {
                            gridContentVertical.Children.Remove(itccRight as UIElement);
                            itccRight.TabParent = this.TabParent;
                            TabParent.RemoveControl(this, itccRight as FrameworkElement);
                            itccRight = null;
                        }
                        else
                        {
                            (this.Parent as Grid).Children.Remove(this);
                            //throw new NullReferenceException("Both ttcRight and itccRight cannot be null");
                        }
                    }
                    else if (ttc == ttcRight)
                    {
                        if (ttcLeft?.Items.Count == 0)
                        {
                        }
                        ttcRight = null;
                        if (null != ttcLeft)
                        {
                            gridContentVertical.Children.Remove(ttcLeft);
                            TabParent.RemoveControl(this, ttcLeft);
                            ttcLeft = null;
                        }
                        else if (null != itccLeft)
                        {
                            gridContentVertical.Children.Remove(itccLeft as UIElement);
                            itccLeft.TabParent = this.TabParent;
                            TabParent.RemoveControl(this, itccLeft as FrameworkElement);
                            itccLeft = null;
                        }
                        else
                        {
                            throw new NullReferenceException("Both ttcLeft and itccLeft cannot be null");
                        }
                    }
                    else
                    {
                        throw new NotSupportedException("Child object not supported");
                    }
                }
            }
        }
 public TearableTabSplitVertical(ITabControlContainer parent)
 {
     this.TabParent = parent;
     InitializeComponent();
 }
Example #7
0
        private void TearableTabControl_ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            TearableTabControl ttc = sender as TearableTabControl;

            if (null != ttc)
            {
                if (0 == ttc.Items.Count)
                {
                    DetachHandlers(ttcTop);
                    DetachHandlers(ttcBottom);

                    ttddTop.DetachDetectorElement();
                    ttddBottom.DetachDetectorElement();

                    DetachHandlers(ttddTop);
                    DetachHandlers(ttddBottom);

                    if (ttc == ttcTop)
                    {
                        ttcTop = null;
                        if (null != ttcBottom)
                        {
                            gridContentHorizontal.Children.Remove(ttcBottom);
                            TabParent.RemoveControl(this, ttcBottom);
                            ttcBottom = null;
                        }
                        else if (null != itccBottom)
                        {
                            gridContentHorizontal.Children.Remove(itccBottom as UIElement);
                            itccBottom.TabParent = this.TabParent;
                            TabParent.RemoveControl(this, itccBottom as FrameworkElement);
                            itccBottom = null;
                        }
                        else
                        {
                            throw new NullReferenceException("Both tccBottom and itccBottom cannot be null");
                        }
                    }
                    else if (ttc == ttcBottom)
                    {
                        if (ttcTop?.Items.Count == 0)
                        {
                        }
                        ttcBottom = null;
                        if (null != ttcTop)
                        {
                            gridContentHorizontal.Children.Remove(ttcTop);
                            TabParent.RemoveControl(this, ttcTop);
                            ttcTop = null;
                        }
                        else if (null != itccTop)
                        {
                            gridContentHorizontal.Children.Remove(itccTop as UIElement);
                            itccTop.TabParent = this.TabParent;
                            TabParent.RemoveControl(this, itccTop as FrameworkElement);
                            itccTop = null;
                        }
                        else
                        {
                            throw new NullReferenceException("Both tccTop and itccTop cannot be null");
                        }
                    }
                    else
                    {
                        throw new NotSupportedException("Child object not supported");
                    }
                }
            }
        }
Example #8
0
 public TearableTabSplitHorizontal(ITabControlContainer parent)
 {
     this.TabParent = parent;
     tabs           = new SerializableDictionary <DropLocation, ITabControlContainer>();
     InitializeComponent();
 }