Esempio n. 1
0
        /*  void IDropTarget.DragOver(IDropInfo dropInfo)
         * {
         *    PegVM sourceItem = dropInfo.Data as PegVM;
         *    PegVM targetItem = dropInfo.Data as PegVM;
         *
         *    if (sourceItem != null && targetItem != null && targetItem.CanAcceptChildren)
         *    {
         *        dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
         *        dropInfo.Effects = DragDropEffects.Copy;
         *    }
         * }*/
        void IDropTarget.DragOver(IDropInfo dropInfo)
        {
            PegVM sourceItem = dropInfo.Data as PegVM;
            PegVM targetItem = dropInfo.Data as PegVM;

            if (sourceItem != null && targetItem != null)
            {
                dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
                dropInfo.Effects           = DragDropEffects.Copy;
                //Pegs = _pegs;
            }
        }
Esempio n. 2
0
        void IDropTarget.Drop(IDropInfo dropInfo)
        {
            PegVM sourceItem = dropInfo.Data as PegVM;
            PegVM targetItem = dropInfo.TargetItem as PegVM;

            if (PegsOnBoard.Contains(targetItem))
            {
                int x = PegsOnBoard.IndexOf(targetItem);
                PegsOnBoard[x] = sourceItem;
                //targetItem = sourceItem;
            }
            //PegsOnBoard.Add(sourceItem);
            Pegs = _pegs;

            //(ObservableCollection)dropInfo.DragInfo.target
            //targetItem.Children.Add(sourceItem);
            //((IList)dropInfo.DragInfo.SourceCollection).Remove(pupil);
            //Pegs.Remove(targetItem);
        }
Esempio n. 3
0
        private void MakePegs()
        {
            PegVM pegYellow = new PegVM()
            {
                PegColor = Brushes.Yellow, Name = "Yellow"
            };
            PegVM pegGreen = new PegVM()
            {
                PegColor = Brushes.Green, Name = "Green"
            };
            PegVM pegRed = new PegVM()
            {
                PegColor = Brushes.Red, Name = "Red"
            };

            Pegs.Add(pegYellow);
            Pegs.Add(pegRed);
            Pegs.Add(pegGreen);
        }