ThinkGeo.com    |     Documentation    |     Premium Support

DragOver, DragDrop not working on HostContainer after 14.4.4

Hello –

We were using thinkgeo core 14.3.1, and we recently updated to 14.4.4.
When we did this, the dragover/dragdrop events we had on the mapview.HostContainer no longer fire.

We noticed the patch notes in 14.4.0 reference the exposed winform events now, so we tried switching directly to those – The dragenter, dragover events here fire, but never accept the drop.

Is this a known issue? What can we do to get the drop working again?

Hi, I had a similar issue with some events not firing, we had to set focusable to true on the map. See if that helps - in the latest beta this is already defaulted to true.

Good Catch Julian! and thanks for chiming in!

Aaron, could you give Julian’s suggestion a try? Just set:

mapView.Focusable = true;

See if that works.

Our mapView is from ThinkGeo.UI.WinForms.MapView, I don’t see this property.

We switched the events to Preview Drag/Drop instead, which are still firing. We just would like to understand why.

Hi Aaron,

You were asking in the WPF section, that’s why Julian and I were thinking you are on WPF.

Can you just use mapView.DragDrop events? The following events work fine.

  mapView.DragDrop += (o, args) =>
  {      System.Diagnostics.Debug.WriteLine("DragDrop");	};
  mapView.DragEnter += (o, args) =>
  {      System.Diagnostics.Debug.WriteLine("DragEnter");	};
  mapView.DragLeave+= (o, args) =>
  {      System.Diagnostics.Debug.WriteLine("DragLeave");	};
  mapView.DragOver += (o, args) =>
  {      System.Diagnostics.Debug.WriteLine("DragOver");	};

Here is a quick Winform DragDrop demo
WinForms_DragDropTest.zip (5.2 KB)

Thanks
Ben

My apologies, I may just misunderstand the architecture here – I thought the map since core has been WPF, and the winforms version is only to host the map in an element host so it can be used in winforms. I already mentioned in my initial post that the new winform events don’t work for us, as the drop is never accepted, so we have switched to the WPF preview events instead.

My question is specifically about the WPF events that used to be firing but no longer do after this update. The winforms forum specifically mentions the mapsuite desktop, which is the old version?
Is my question better handled there anyway?

You are correct: the WinForms edition is essentially built on top of the internal WPF map implementation. Most of its APIs are inherited from the underlying WPF map, except for those defined directly in the MapView class.

That said, we generally do not recommend using mapView.HostContainer . It is considered an internal integration surface and is not part of the tested API surface, so its behavior may change between versions unexpectedly. Instead, we suggest using the events exposed directly on MapView, which are part of the supported API and are covered by our testing.

Does the sample I provided work on your side, or are you still experiencing any related issues?

Regarding your other point ---- you’re absolutely right. The WinForms forum description mentioned “Map Suite,” which indeed causes confusion and makes it appear to refer to the old product line. We’ve updated the description to remove that reference. Thank you for catching that!

The mapview drag events seem to work fine, I can get enter/over without issue - but we can’t get the map to accept the drop itself. We are changing the DragEventArgs.Effects to link when using to WPF events to achieve this, but for the mapview the equivalent doesn’t work. Thanks for updating the winforms forum description and clarifying what it’s for, I can certainly go ask about the mapview dragdrop and why it doesn’t work in my particular environment over there.

Since we have it working now using the preview events — we just want to know what happened to determine how much risk we have keeping our current implementation.
My guess is that you have redirected the above events to the mapview itself so they no longer get to the HostContainer as before, but there is no equivalent to the preview events in winforms so these were unchanged?

Hi Aaron,

Your analysis is correct.

What changed:

  • Starting in 14.4.0, WinForms MapView added its own drag events by bridging from WPF preview events.
  • In that bridge, PreviewDragEnter/PreviewDragOver were marked handled (e.Handled = true), so routed drag events no longer propagated to HostContainer as they did before.

Why Drop was not accepted:

  • The bridge hard-coded Copy for drag effects.
  • The DragEventArgs.Effect you set in mapView.DragEnter/DragOver was not written back
    to the underlying WPF event args.
  • So if your source required Link (or another non-Copy effect), WPF still saw Copy, and the
    drop source would reject the operation.

This issue was just fixed in the latest 14.5.0-beta096:

  • Drag effects now correctly round-trip between WinForms and WPF (DragOver/Drop).
  • Drop bridge uses PreviewDrop, consistent with the other preview drag events.
  • Events are only marked handled when corresponding MapView handlers are actually
    subscribed.
  • All data formats are now marshaled (previously only FileDrop was supported).

Your old code should work with ThinkGeo.UI.WinForms 14.5.0-beta096. You’re also
welcome to continue with your current Preview-event workaround if you prefer.

Thanks,
Ben

Thank you Ben,

That explanation is just what I was looking for, and we will look forward to the official 14.5.0 release.

I appreciate the time you took to look into this for me —

No problem! Thank you for letting us know this issue, Aaron!