Exemplo n.º 1
0
        protected virtual object StartItemDrag(SideTabItem draggedItem)
        {
            SpecialDataObject dataObject = new SpecialDataObject();

            dataObject.SetData(draggedItem.Tag);
            dataObject.SetData(draggedItem);
            return(dataObject);
        }
Exemplo n.º 2
0
            protected override void OnMouseMove(MouseEventArgs e)
            {
                base.OnMouseMove(e);
                if (e.Button == MouseButtons.Left)
                {
                    SideTabItem item = sideBar.activeTab.GetItemAt(e.X, e.Y);

                    if (item != null)
                    {
                        if (IsDragStarted(mouseDownPos, e.Location))
                        {
                            sideBar.Tabs.DragOverTab = sideBar.activeTab;
                            SpecialDataObject dataObject = new SpecialDataObject();
                            dataObject.SetData(item.Tag);
                            dataObject.SetData(item);

                            DoDragDrop(dataObject, sideBar.activeTab.CanDragDrop ? DragDropEffects.All : (DragDropEffects.Copy | DragDropEffects.None));
                        }
                        Refresh();
                    }
                }
                else
                {
                    SideTabItem oldItem = sideBar.activeTab.SelectedItem;
                    sideBar.activeTab.SelectedItem = null;
                    mousePosition = new Point(e.X, e.Y);
                    SideTabItem item = sideBar.activeTab.GetItemAt(e.X, e.Y);

                    if (item != null)
                    {
                        sideBar.activeTab.SelectedItem = item;
                    }

                    if (oldItem != sideBar.activeTab.SelectedItem)
                    {
                        sideBar.Refresh();
                    }
                }
            }