<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MapView.GetOverlayControls returns wrappers instead of added controls in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876688#M5448</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any news?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 May 2019 20:29:04 GMT</pubDate>
    <dc:creator>MaxMax2</dc:creator>
    <dc:date>2019-05-09T20:29:04Z</dc:date>
    <item>
      <title>MapView.GetOverlayControls returns wrappers instead of added controls</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876686#M5446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's see an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; mapToolsOverlayControl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;MapToolsOverlayControl&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    DataContext &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;MapToolsOverlayControlViewModel&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;AddOverlayControl&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mapToolsOverlayControl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then if I call&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MapView.Active.GetOverlayControls()&lt;/SPAN&gt;, I'll get objects of these types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ArcGIS.Desktop.Internal.Mapping.Controls.MapCreditsControl&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;ArcGIS.Desktop.Internal.Mapping.Controls.AirspaceControlWrapper&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is my&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;MapToolsOverlayControl&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inspecting things with reflection I found that&amp;nbsp;&lt;SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;GetOverlayControls&lt;/SPAN&gt; returns &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;UIElement&lt;/SPAN&gt;s that has &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;UserControl&lt;/SPAN&gt; property. So I'm able to find my control with reflection. But why it is wrapped to some internal class (&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;AirspaceControlWrapper&lt;/SPAN&gt;)? It's not what user expects from &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;AddOverlayControl&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you need to wrap added control for some reason, please return new object from&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;AddOverlayControl&lt;/SPAN&gt; and give a remark in docs with snippet of how to get a control after it's added on map.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 11:00:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876686#M5446</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T11:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.GetOverlayControls returns wrappers instead of added controls</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876687#M5447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Max, this&amp;nbsp;could be a bug. I'll look into it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2019 01:02:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876687#M5447</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2019-05-08T01:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.GetOverlayControls returns wrappers instead of added controls</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876688#M5448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any news?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2019 20:29:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876688#M5448</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2019-05-09T20:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.GetOverlayControls returns wrappers instead of added controls</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876689#M5449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So Max, I have looked closely at this and discussed with the original developer.This is designed behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please use GetOverlayControls to examine which controls are already on the overlay. The returned UIElements can then be queried for their size and placement information [on the overlay]. For example, perhaps you have a preferred placement and prior to adding your control you want to detect if a control (perhaps placed by Pro or another add-in) already occupies that "space". Based on your examination of the existing overlay controls, your logic could adjust your default position accordingly, alter ZOrder, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not intended that you cast the controls to their underlying type. Simply use them "as" UIElement. Cast to FrameworkElement also, if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do need reference to your control "later on" you should hold a reference to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We will update the API reference for AddOverlayControl and GetOverlayControls for 2.4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2019 23:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-getoverlaycontrols-returns-wrappers/m-p/876689#M5449</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2019-05-09T23:23:12Z</dc:date>
    </item>
  </channel>
</rss>

