<?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: ActiveMapViewChanged event fires twice in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765339#M397</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the explanation of ActiveMapViewChanged event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActivePaneChanged event helps resolve the issue. Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Mar 2020 06:02:45 GMT</pubDate>
    <dc:creator>sai_phaneendra</dc:creator>
    <dc:date>2020-03-18T06:02:45Z</dc:date>
    <item>
      <title>ActiveMapViewChanged event fires twice</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765337#M395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am&amp;nbsp;working with ActiveMapViewChanged event&amp;nbsp;as shown in the code snippet.&lt;/P&gt;&lt;P&gt;&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;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;SubscribeMapEvents&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;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
   ActiveMapViewChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;UpdateUIElements&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="keyword token"&gt;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;UpdateUIElements&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ActiveMapViewChangedEventArgs obj&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;obj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;IncomingView &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="token function"&gt;ReInitializeUIElements&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;
   &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="token function"&gt;ResetUIElements&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;
&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;/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;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;Idea is to&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;update the UI elements with the information from MapView when it&amp;nbsp;changes and&lt;/LI&gt;&lt;LI&gt;reset to initial state when there is no map view.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The event triggers correctly when there is no map&amp;nbsp;with&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;IncomingView&lt;/EM&gt;&lt;/STRONG&gt; value as&amp;nbsp;&lt;STRONG&gt;null,&lt;/STRONG&gt; and when it updates the event is triggered with active map view's instance in the &lt;STRONG&gt;&lt;EM&gt;IncomingView&lt;/EM&gt;&lt;/STRONG&gt; parameter.&amp;nbsp;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whereas, when I open an attribute table from Table of contents with an active map, this event is triggered twice.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;First time with&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;IncomingView&lt;/STRONG&gt;&lt;/EM&gt; as &lt;EM&gt;&lt;STRONG&gt;null&lt;/STRONG&gt;&lt;/EM&gt; and&lt;/LI&gt;&lt;LI&gt;the second time with the active map view's instance.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This behavior is causing an unwanted reset of the controls even when there is an active map present.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:29:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765337#M395</guid>
      <dc:creator>sai_phaneendra</dc:creator>
      <dc:date>2021-12-12T08:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: ActiveMapViewChanged event fires twice</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765338#M396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would suggest that you should use ActivePaneChangedEvent instead. The type of pane returned when the Active Pane changes will tell you if it is a Map Pane or&amp;nbsp;a Table. It will be MapPaneViewModel for an Active Map or TablePaneViewModel for a Table.&amp;nbsp; Code snippet:&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="comment token"&gt;//Subscribe to event&lt;/SPAN&gt;
ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Desktop&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Framework&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Events&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ActivePaneChangedEvent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Subscribe&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OnActivePaneChanged&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;OnActivePaneChanged&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PaneEventArgs obj&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;obj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;IncomingPane &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      System&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Diagnostics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Debug&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;WriteLine&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$&lt;SPAN class="string token"&gt;"Debug Message. GetTypeName: {obj.IncomingPane.GetType().Name}"&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;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/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;A little background on the behavior you are seeing with ActiveMapViewChanged event -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you display the attribute table of a feature layer in the Active map, the IncomingView is first null (which is correct).&lt;BR /&gt;The attribute table pane then becomes the active pane. But when the attribute table pane is active, the TOC that lists the layers needs to know the “context” of which map it needs to use.&lt;BR /&gt;So the Attribute table pane that is currently active, “impersonates” the Map Pane. Hence the event gets triggered again and the Incoming View is now the “Map” associated with the attribute table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Uma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:29:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765338#M396</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2021-12-12T08:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: ActiveMapViewChanged event fires twice</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765339#M397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the explanation of ActiveMapViewChanged event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActivePaneChanged event helps resolve the issue. Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2020 06:02:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/activemapviewchanged-event-fires-twice/m-p/765339#M397</guid>
      <dc:creator>sai_phaneendra</dc:creator>
      <dc:date>2020-03-18T06:02:45Z</dc:date>
    </item>
  </channel>
</rss>

