Dynamic Drop Targets?

Oct 17, 2009 at 6:38 AM

Hi Guys,

 

I was wondering if anyone has tried to, or knows how I can dynamically add droptargets?

 

From looking at the sample code I can do something like this.... but if I want to add say 50 of them its kinda not the way I want to do it.

 

DropTarget dropTarget1 = new DropTarget() {Ghost = new DropTargetGhost()  
            , Width = 100, Height = 100, };
            DropTarget dropTarget2 = new DropTarget() { Ghost = new DropTargetGhost()
            , Width = 100, Height = 100};
            DropTarget dropTarget3 = new DropTarget() { Ghost = new DropTargetGhost()
            , Width = 100, Height = 100};
            DropTarget dropTarget4 = new DropTarget() { Ghost = new DropTargetGhost()
            , Width = 100, Height = 100};
            DropTarget dropTarget5 = new DropTarget() { Ghost = new DropTargetGhost()
            , Width = 100, Height = 100};
            DropTarget dropTarget6 = new DropTarget() { Ghost = new DropTargetGhost()
            , Width = 100, Height = 100};
       

            DropTargetPanels.Children.Add(dropTarget1);
            DropTargetPanels.Children.Add(dropTarget2);
            DropTargetPanels.Children.Add(dropTarget3);
            DropTargetPanels.Children.Add(dropTarget4);
            DropTargetPanels.Children.Add(dropTarget5);
            DropTargetPanels.Children.Add(dropTarget6);


Then the second question is how to I add event Handlers for the drop targets? Whether they are added dynamically or not?

 

cheers.