Пример #1
0
        private void dragObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            mouseLeftButtonDown = true;
            mouseStartPoint     = e.GetPosition(null);
            System.Windows.Controls.Control control = sender as System.Windows.Controls.Control;
            originalTargetPos = GetPoint(control);
            control.CaptureMouse();

            foreach (DragObject c in dragList)
            {
                System.Windows.Controls.Control con = sender as System.Windows.Controls.Control;
                if (c.target == con)
                {
                    draggingTarget = c;
                    Canvas.SetZIndex(draggingTarget.target, 2);
                    Canvas.SetZIndex(dragCanvas, 2);
                }
            }
        }
Пример #2
0
        void selectedDevice_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            selectedDevice = (Control)sender;
            selectedDevice.CaptureMouse();
            deltaX = e.GetPosition(grdDeviceLayer).X - ((Thickness)selectedDevice.GetValue(Grid.MarginProperty)).Left;
            deltaY = e.GetPosition(grdDeviceLayer).Y - ((Thickness)selectedDevice.GetValue(Grid.MarginProperty)).Top;

            UnSelectAllDevice();

            (sender as I_IO).IsSelect = true;
            this.grdSetting.DataContext = selectedDevice.DataContext;
           // throw new NotImplementedException();
        }