コード例 #1
0
        private void panel_Drop(object sender, DragEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }
            var panel   = (Panel)sender;
            var element = (UIElement)e.Data.GetData("Object");

            if (panel == null || element == null)
            {
                return;
            }
            var parent = (Panel)VisualTreeHelper.GetParent(element);

            if (parent == null)
            {
                return;
            }
            if (e.KeyStates == DragDropKeyStates.ControlKey &&
                e.AllowedEffects.HasFlag(DragDropEffects.Copy))
            {
                var classView = new ClassView((ClassView)element);
                panel.Children.Add(classView);
                e.Effects = DragDropEffects.Copy;
            }
            else if (e.AllowedEffects.HasFlag(DragDropEffects.Move))
            {
                parent.Children.Remove(element);
                panel.Children.Add(element);
                e.Effects = DragDropEffects.Move;
            }
        }
コード例 #2
0
ファイル: ClassView.xaml.cs プロジェクト: tekavec/VisualCode
 public ClassView(ClassView classView)
 {
     InitializeComponent();
     ClassViewUi.Height = classView.ClassViewUi.Height;
     ClassViewUi.Width  = classView.ClassViewUi.Width;
     ClassViewUi.Fill   = classView.ClassViewUi.Fill;
 }