Example #1
0
        private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            this.designerItem = DataContext as DesignerItem;

            if (this.designerItem != null)
            {
                this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem);
            }
        }
Example #2
0
        private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            this.designerItem = DataContext as DesignerItem;

            if (this.designerItem != null)
            {
                this.designerCanvas = VisualHelper.FindAnchestor <DrawingLayer>(this.designerItem) as DrawingLayer;

                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.designerCanvas);
                if (adornerLayer != null)
                {
                    this.adorner = new SizeAdorner(this.designerItem);
                    adornerLayer.Add(this.adorner);
                }
            }
        }
Example #3
0
        void _drager_OnContinueDrag(object sender, MouseEventArgs e)
        {
            try
            {
                // Get the dragged ListViewItem
                ListViewItem item = VisualHelper.FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource);

                if (item != null)
                {
                    object associatedData = this.ItemContainerGenerator.ItemFromContainer(item);
                    _drager.DragDropContinue(associatedData != null);
                }
            }
            catch (Exception err)
            {
                LogHelper.Manage("ExtendedlistView:drag_OnStartDrag", err);
            }
        }
Example #4
0
        void drag_OnStartDrag(object sender, MouseEventArgs e)
        {
            try
            {
                // Get the dragged ListViewItem
                ListViewItem item = VisualHelper.FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource);

                if (item != null)
                {
                    object associatedData = this.ItemContainerGenerator.ItemFromContainer(item);

                    // Find the data behind the item + Initialize the drag & drop operation
                    DataObject dragData = new DataObject(DragAndDropID, associatedData);
                    _drager.DoDragDrop(dragData, item);
                }
            }
            catch (Exception err)
            {
                LogHelper.Manage("ExtendedlistView:drag_OnStartDrag", err);
            }
        }
Example #5
0
        protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
        {
            base.OnPreviewMouseDown(e);
            DrawingLayer designer = VisualHelper.FindAnchestor <DrawingLayer>(this) as DrawingLayer;

            if (designer != null)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    this.IsSelected = !this.IsSelected;
                }
                else
                {
                    if (!this.IsSelected)
                    {
                        designer.DeselectAll();
                        this.IsSelected = true;
                    }
                }
            }

            e.Handled = false;
        }