c# - Drag and drop custom object -


i have 2 controls 1 one form: list , tree (specific type names irrelevant).

in list control execute dodragdrop method. first argument pass object data bound row. object implements specific interface , marked serializable attribute.

what want retreive object in dragenter/dragdrop event handler of tree control. i'm using following code:

void treecontroldragenter(object sender, drageventargs e) {     var formats = e.data.getformats();     var data = e.data.getdata(typeof (ifoo)); } 

unfortunately, in result data null , formats one-element array holds name of specific type (implementing ifoo). assume have pass exact type name getdata retreve object, it's not possible private class.

is there way object interface?

you have provide same type class serialized in first place. cannot use interface or base class of serialized class because more 1 of formats might match , not know 1 deserialize. if have several classes implement ifoo , there instance of each inside data object asking ifoo ambiguous. must ask exact type serialized data object.

this means should not place classes data object cannot deserialized because private @ other end.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -