# Clearing InteractiveOverlays gives problems

**URL:** <https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210>\
**Category:** WinForms\
**Created:** [May 5, 2010, 2:37am UTC](https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210 "2010-05-05T02:37:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/b2d939/32.png) [@Christian](https://community.thinkgeo.com/u/Christian)\
**Post date:** [May 5, 2010, 2:37am UTC](https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210/1 "2010-05-05T02:37:02Z")

</div>

&nbsp;Hi,

I'm&nbsp;not&nbsp;sure&nbsp;if&nbsp;this&nbsp;could&nbsp;be&nbsp;a&nbsp;possible&nbsp;bug&nbsp;but&nbsp;after&nbsp;clearing&nbsp;the&nbsp;InteractiveOverlays&nbsp;collection&nbsp;of&nbsp;a&nbsp;map&nbsp;(WPF,&nbsp;winforms)&nbsp;with&nbsp;map.InteractiveOverlays.Clear();&nbsp;new&nbsp;instances&nbsp;of&nbsp;EditOverlay&nbsp;and&nbsp;TrackOverlay&nbsp;need&nbsp;to&nbsp;be&nbsp;created&nbsp;in&nbsp;order&nbsp;to&nbsp;use&nbsp;them&nbsp;for&nbsp;editing.&nbsp;After&nbsp;the&nbsp;new&nbsp;instances&nbsp;are&nbsp;created&nbsp;and&nbsp;after&nbsp;setting&nbsp;the&nbsp;trackmode&nbsp;of&nbsp;the&nbsp;TrackOvleray&nbsp;to&nbsp;a&nbsp;particular&nbsp;shape,&nbsp;nothing&nbsp;happens&nbsp;in&nbsp;the&nbsp;TrackEnded&nbsp;event&nbsp;of&nbsp;the&nbsp;TrackOverlay&nbsp;after&nbsp;drawing&nbsp;a&nbsp;shape&nbsp;on&nbsp;the&nbsp;map.&nbsp;Hence,&nbsp;no&nbsp;shape&nbsp;appears.&nbsp;

Any&nbsp;ideas?

Regards,

Nat

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [May 6, 2010, 2:02am UTC](https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210/2 "2010-05-06T02:02:29Z")

</div>

Christian,

I&nbsp;tried&nbsp;the&nbsp;following&nbsp;code,&nbsp;and&nbsp;it&nbsp;works&nbsp;fine&nbsp;like&nbsp;a&nbsp;champs.

`winformsMap1.MapUnit = GeographyUnit.DecimalDegree;winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);winformsMap1.InteractiveOverlays.Clear();            TrackInteractiveOverlay trackInterativeOverlay = new TrackInteractiveOverlay();winformsMap1.TrackOverlay = trackInterativeOverlay;winformsMap1.InteractiveOverlays.Add(trackInterativeOverlay);EditInteractiveOverlay editInteractiveOverlay = new EditInteractiveOverlay();winformsMap1.EditOverlay = editInteractiveOverlay;winformsMap1.InteractiveOverlays.Add( editInteractiveOverlay);ExtentInteractiveOverlay extentInteractiveOverlay = new ExtentInteractiveOverlay();winformsMap1.ExtentOverlay = extentInteractiveOverlay;          winformsMap1.InteractiveOverlays.Add(extentInteractiveOverlay);winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);winformsMap1.Refresh();`

Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.

Thanks.

Yale  
  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Christian](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/b2d939/32.png) [@Christian](https://community.thinkgeo.com/u/Christian)\
**Post date:** [May 10, 2010, 1:20am UTC](https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210/3 "2010-05-10T01:20:04Z")

</div>

Hi,,

Thx!&nbsp;I&nbsp;found&nbsp;the&nbsp;problem.&nbsp;It&nbsp;seems&nbsp;though&nbsp;the&nbsp;Edit&nbsp;and&nbsp;Track&nbsp;Interactive&nbsp;Overlays&nbsp;form&nbsp;part&nbsp;of&nbsp;the&nbsp;InteractiveOverlays&nbsp;collection,&nbsp;so&nbsp;that&nbsp;when&nbsp;the&nbsp;collection&nbsp;is&nbsp;cleared,&nbsp;so&nbsp;are&nbsp;the&nbsp;Edit&nbsp;and&nbsp;Track&nbsp;Overlays.&nbsp;I&nbsp;don't&nbsp;think&nbsp;it&nbsp;was&nbsp;like&nbsp;this&nbsp;prior&nbsp;to&nbsp;version4.&nbsp;I&nbsp;could&nbsp;be&nbsp;mistaken.&nbsp;All&nbsp;I&nbsp;did&nbsp;was&nbsp;remove&nbsp;all&nbsp;interactive&nbsp;overlays&nbsp;except&nbsp;the&nbsp;Edit&nbsp;and&nbsp;Track&nbsp;Ovberlays.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [May 10, 2010, 7:38pm UTC](https://community.thinkgeo.com/t/clearing-interactiveoverlays-gives-problems/1210/4 "2010-05-10T19:38:23Z")

</div>

Christian,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;reply.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;only&nbsp;remember&nbsp;we&nbsp;did&nbsp;some&nbsp;minor&nbsp;changes&nbsp;on&nbsp;the&nbsp;GeoCollection&nbsp;itself,&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;that&nbsp;is&nbsp;the&nbsp;reason&nbsp;for&nbsp;this&nbsp;problem.&nbsp;While,&nbsp;we&nbsp;did&nbsp;not&nbsp;change&nbsp;this&nbsp;logic&nbsp;for&nbsp;quite&nbsp;a&nbsp;long&nbsp;time&nbsp;since&nbsp;then.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;
