Jump to content
  • Advertisement
Sign in to follow this  
Niksan2

[.net] IDataObject.GetDataPresent (Type) problems

This topic is 4080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've probably not understood how this works so here goes. I have two classes public class A {} and public class B : A {} I do a DoDragDrop call passing in an instance of B and when I get a Drag* event I do a check like so, if(e.Data.GetDataPresent(typeof(A))==true) .... looking at the data within e.Data it is the B class that's there, however, GetDataPresent returns false. According to the MSDN docs it says the following "Determines whether data stored in this instance is associated with, or can be converted to, the specified format.", now I would have thought this was true being a derived class and all that, but appears not, anyone know how to go around making this work ? Cheers, Nik EDIT: I tried using e.Data.GetFormats() which supposedly reports what this item can be converted to etc, needless to say it only reports B :/

Share this post


Link to post
Share on other sites
Advertisement
Nevermind, I resorted to using a DragDrop container class which holds the actual class being dragged.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!