示例#1
0
        private void Samplebutton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (_buttonPosition == null)
            {
                _buttonPosition = ((UserControl)sender).TransformToAncestor(MyGrid).Transform(new Point(0, 0));
            }
            var mousePosition = Mouse.GetPosition(MyGrid);

            deltaX = mousePosition.X - _buttonPosition.Value.X;
            deltaY = mousePosition.Y - _buttonPosition.Value.Y;
            MyBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(81, 81, 81));
            _isMoving            = true;
            Grid.SetZIndex(this, index++);
            Panel.SetZIndex(this, 666);
            UniformGrid.SetZIndex(this, index++);
        }