public SchuelerGUI(SchuelerGUI s) { InitializeComponent(); this.schuelerUI.Height = s.schuelerUI.Height; this.schuelerUI.Width = s.schuelerUI.Height; this.schuelerUI.Fill = s.schuelerUI.Fill; }
private void Panel_Drop(object sender, DragEventArgs e) { // If an element in the panel has already handled the drop, // the panel should not also handle it. if (e.Handled == false) { Panel _panel = (Panel)sender; UIElement _element = (UIElement)e.Data.GetData("Object"); if (_panel != null && _element != null) { // Get the panel that the element currently belongs to, // then remove it from that panel and add it the Children of // the panel that its been dropped on. Panel _parent = (Panel)VisualTreeHelper.GetParent(_element); if (_parent != null) { if (e.KeyStates == DragDropKeyStates.ControlKey && e.AllowedEffects.HasFlag(DragDropEffects.Move)) { SchuelerGUI _schuelerGUI = new SchuelerGUI((SchuelerGUI)_element); _panel.Children.Add(_schuelerGUI); // set the value to return to the DoDragDrop call e.Effects = DragDropEffects.Move; } else if (e.AllowedEffects.HasFlag(DragDropEffects.Copy)) { _parent.Children.Remove(_element); _panel.Children.Add(_element); // set the value to return to the DoDragDrop call e.Effects = DragDropEffects.Copy; } } } } }