Exemple #1
0
 public Circle(Circle c)
 {
     InitializeComponent();
     this.circleUI.Height = c.circleUI.Height;
     this.circleUI.Width = c.circleUI.Height;
     this.circleUI.Fill = c.circleUI.Fill;
 }
        private void panel_Drop(object sender, DragEventArgs e)
        {
            if (e.Handled == false)
            {
                Panel _panel = (Panel) sender;
                UIElement _element = (UIElement) e.Data.GetData("Object");

                if (_panel != null && _element != null)
                {
                    Panel _parent = (Panel) VisualTreeHelper.GetParent(_element);

                    if (e.KeyStates == DragDropKeyStates.ControlKey && e.AllowedEffects.HasFlag(DragDropEffects.Copy))
                    {
                        Circle _circle = new Circle((Circle)_element);
                        _panel.Children.Add(_circle);
                        e.Effects = DragDropEffects.Copy;
                    }
                    else if (e.AllowedEffects.HasFlag(DragDropEffects.Move))
                    {
                        _parent.Children.Remove(_element);
                        _panel.Children.Add(_element);
                        e.Effects = DragDropEffects.Move;
                    }
                }
            }
        }