Example #1
0
        private void ThumbDragCompleted(object sender, DragCompletedEventArgs args)
        {
            EffectWindow.CloseEffect();

            if (args != null && !MousePosInMeasureSize())
            {
                this.RaiseDragCompletedEvent(new DragTabCompletedEventArgs()
                {
                    TabItem = (TabItem)DragChache.DragingSource,
                    IsAtTargetDragTabControl = false,
                    SourceTabControl         = this.TryFindParent <DragTabControl>(),
                    MouseLastPoint           = Native.GetCursorPos(),
                    StartPointInElement      = DragChache.PointInElement
                });
            }
            if (Items.Count == 0)
            {
                Window.GetWindow(this)?.Close();
            }
            if (Items.Count == 1)
            {
                var win = Window.GetWindow(this);
                win.Opacity = 1;
                //win.Visibility = Visibility.Visible;
            }
            DragChache.DragingSource = null;
        }
Example #2
0
        private void ThumbDragDelta(object sender, DragDeltaEventArgs e)
        {
            DragTabItem container = null;
            Thumb       tb        = e.OriginalSource as Thumb;

            if (tb != null)
            {
                container = tb.TryFindParent <DragTabItem>();
            }
            var itemscontrol = this;

            if (!Items.Contains(container.Content))
            {
                return;
            }
            this.RaiseDragDeltaEvent(e);
            EffectWindow.MoveLocation(e.HorizontalChange, e.VerticalChange);

            //if (itemscontrol.Items.Contains(container.Content))
            //{
            //if (container.ActualHeight <= e.VerticalChange || -e.VerticalChange >= container.ActualHeight)
            //{
            //DragChache.DragingSource = container.Content;
            //return;
            //}
            //var pos = Mouse.GetPosition(this).ToWpf();
            //鼠标没有在DragImtesControls范围内
            //if (!PosInMeasureSize(pos)) return;
            //if (container.ActualWidth / 2 < e.HorizontalChange)
            //{
            //    var items =
            //        itemscontrol.TryFindParent<DragTabControl>().Items;
            //    var len = items.Count;
            //    var index = items.IndexOf(container.Content);
            //    if (len == index + 1)
            //    {
            //        return;
            //    }
            //    var tabitem = container.Content;
            //    items.Remove(tabitem);
            //    items.Insert(index + 1, tabitem);
            //    ThumbDragCompleted(this, null);
            //}

            //if (container.ActualWidth / 2 < -e.HorizontalChange)
            //{
            //    var items = itemscontrol.TryFindParent<DragTabControl>().Items;
            //    var index = items.IndexOf(container.Content);
            //    if (index == 0) return;
            //    var tabitem = container.Content;
            //    items.Remove(tabitem);
            //    items.Insert(index - 1, tabitem);
            //    ThumbDragCompleted(this, null);
            //}
            //}
        }
Example #3
0
        private void ThumbDragStarted(object sender, DragStartedEventArgs e)
        {
            DragTabItem container = null;
            Thumb       tb        = e.OriginalSource as Thumb;

            if (tb != null)
            {
                container = tb.TryFindParent <DragTabItem>();
            }
            DragChache.DragingSource  = container.Content;
            DragChache.PointInElement = Mouse.GetPosition(container);
            if (Items.Count == 1)
            {
                var win = Window.GetWindow(this);
                win.Opacity = 0;
                //win.Visibility = Visibility.Collapsed;
            }
            EffectWindow.ShowEffect(container);
        }