Hi Nadav,
I agree, it does seem a little odd to use ISelectionService and it
would be nice to have some type of reference passed in DrapEventArgs.
[quoted text, click to view] >From what it looks like to me the drag and drop events are designed
more for dragging things like text into a text box rather then a
control onto another control. That's the only reason I can figure it's
not there. However, after using ISelectionService I found it really
accomplishes the same thing. Further more its a better fit when you
consider what happens when you select multiple controls and drop them
all on the parent at once.
You mentioned having to make changes to the custom control to implement
this. Are you just getting a reference to the ISelectionService in
your OnDragDrop function then calling getselectedcomponents or
primaryselection?
I'm happy you were able to get this working.
Kind Regards,
Jerron
[quoted text, click to view] Nadav wrote:
> Hi Jeffrey,
>
> Thanks for your posting!
>
> > Does your "Drag&Drop event" refer to ControlDesigner's OnDrag***
methods?
> > Or you implement some way yourself?
> I override void OnDragDrop(DragEventArgs de) in the custom designer.
> if I move a control on my GridLayout control,
> Then de.Effect==DragDropEffects.Move and de.Data should (as I
understand it)
> contain the Control being dragged.
>
> > I agree with Jerron that at design-time, the standard way of
getting the
> > selected object is using ISelectionService.
> It just seems odd to me to have to go and make changes to the custom
control
> in order to get the selected controls from it,
> instead of using the DrapEventArgs, that should have the information
needed.
> But I can't get the information from the de.Data.
> No matter what parameter I pass to de.Data.GetData() it returns null.
>
> > Also, do you still have any concern on this issue? Please feel free
to tell
> > me, thanks.
> I've implemented it using ISelectionService, and it works.
> It's just seems strange to do it like this...
>
> Thanks,
> Nadav