<?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 Notification of active edit template change in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/notification-of-active-edit-template-change/m-p/779013#M1053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings.&amp;nbsp; I am trying to get notification when the active edit template changes.&amp;nbsp; There doesn't seem to be an event available to handle this, so I am listening for PropertyChanged events on all the edit templates and checking for the "IsActive" property name (see code below).&amp;nbsp; The problem I am encountering is that the handler is getting called multiple times&amp;nbsp;on the same template for the "IsActive" property name, but the property is not changing.&amp;nbsp; I don't see the IsActive property change to "true" except when the active tool doesn't change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if my current layer is polygon and I change to a different layer that is also polygon, the IsActive property does change to "true" on the new template.&amp;nbsp; Also, if the current layer has subtypes and I'm just changing to a different subtype within the same layer, then the property value changes as expected.&amp;nbsp; However, changing between layers of different geometry types (which triggers a change in the active tool) results in the property changed handler never getting notified of the active template.&amp;nbsp; The calls are being made, but the value for IsActive is always false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, what is the most efficient way to get notification of active edit template changes?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public bool Register()&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;var layers = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;();&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var fl in layers) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var template in MappingExtensions.GetTemplates(fl)) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;template.PropertyChanged +=&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new PropertyChangedEventHandler(TemplatePropertyChanged);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private void TemplatePropertyChanged(Object sender, PropertyChangedEventArgs args)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if (args.PropertyName == "IsActive") {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EditingFeatureTemplate template = sender as EditingFeatureTemplate;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Do something&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Dec 2018 08:01:39 GMT</pubDate>
    <dc:creator>MichaelPanlasigui</dc:creator>
    <dc:date>2018-12-16T08:01:39Z</dc:date>
    <item>
      <title>Notification of active edit template change</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/notification-of-active-edit-template-change/m-p/779013#M1053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings.&amp;nbsp; I am trying to get notification when the active edit template changes.&amp;nbsp; There doesn't seem to be an event available to handle this, so I am listening for PropertyChanged events on all the edit templates and checking for the "IsActive" property name (see code below).&amp;nbsp; The problem I am encountering is that the handler is getting called multiple times&amp;nbsp;on the same template for the "IsActive" property name, but the property is not changing.&amp;nbsp; I don't see the IsActive property change to "true" except when the active tool doesn't change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if my current layer is polygon and I change to a different layer that is also polygon, the IsActive property does change to "true" on the new template.&amp;nbsp; Also, if the current layer has subtypes and I'm just changing to a different subtype within the same layer, then the property value changes as expected.&amp;nbsp; However, changing between layers of different geometry types (which triggers a change in the active tool) results in the property changed handler never getting notified of the active template.&amp;nbsp; The calls are being made, but the value for IsActive is always false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, what is the most efficient way to get notification of active edit template changes?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public bool Register()&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;var layers = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;();&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var fl in layers) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var template in MappingExtensions.GetTemplates(fl)) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;template.PropertyChanged +=&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new PropertyChangedEventHandler(TemplatePropertyChanged);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private void TemplatePropertyChanged(Object sender, PropertyChangedEventArgs args)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if (args.PropertyName == "IsActive") {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EditingFeatureTemplate template = sender as EditingFeatureTemplate;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Do something&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2018 08:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/notification-of-active-edit-template-change/m-p/779013#M1053</guid>
      <dc:creator>MichaelPanlasigui</dc:creator>
      <dc:date>2018-12-16T08:01:39Z</dc:date>
    </item>
  </channel>
</rss>

