Groups | Blog | Home
all groups > dotnet windows forms designtime > january 2006 >

dotnet windows forms designtime : System.Windows.Forms.Design.Behavior.DropSourceBehavior



jokiz
1/5/2006 6:14:47 PM
i'm not familiar with 2.0 but perhaps you can hook up with
componentadding event of IComponentChangeService just like 1.1
thomas hulka
1/6/2006 1:55:08 AM
The type of Drag-and-Drop data in a Windows Forms Designer (eg derived from
ControlDesigner)
is of type

System.Windows.Forms.Design.Behavior.DropSourceBehavior

To my surprise this class is defined internal in System.Design. How can one
find out the control is dragged?
I believe this class should not be internal.

~thomas

thomas hulka
1/6/2006 3:58:36 AM
Thank you for the hint, since I am using the whole draganddrop
infrastructure, this would
lead to a difficile design. At this time, I am using a workaround via
reflection:

Type t = de.Data.GetType();
if (t.Name == "BehaviorDataObject")
{
PropertyInfo pi = t.GetProperty("DragComponents");
ArrayList comps = pi.GetValue(de.Data, null) as ArrayList;
if (comps != null && comps.Count > 0)
{
object o = comps[0]; //
here I get my dragged OutputControl
if (o.GetType() == typeof(OutputControl)) { // lets see if
is really an OutputControl


This returns the DragComponents property from DropSourceBehavior which in
turn holds
the dragged control in its ArrayList.

However, I would like Microsoft to notice that there is a problem with
keeping DropSourceBehavior internal.
Or maybe I missed something. Also to MS: VS 2005 is superdupergreat! i love
it!

thanks jokiz



[quoted text, click to view]

AddThis Social Bookmark Button