<?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: What condition can I use to enable a button when a feature is selected? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/what-condition-can-i-use-to-enable-a-button-when-a/m-p/813747#M2449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved this - maybe there is a better way, but this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Module code, Initialize method, I subscribe to the selection event:&lt;BR /&gt; ArcGIS.Desktop.Mapping.Events.MapSelectionChangedEvent.Subscribe(MapSelectionChanged);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I can check the selected features for a selection made to my layer and activate the condition:&lt;/P&gt;&lt;P&gt;private void MapSelectionChanged(MapSelectionChangedEventArgs obj)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;FrameworkApplication.State.Activate("condition_is_project_selected");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var item in obj.Selection)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (item.Key.ToString().Contains("Projects"))&lt;BR /&gt; &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;FrameworkApplication.State.Deactivate("condition_is_project_selected");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Oct 2020 19:32:42 GMT</pubDate>
    <dc:creator>SarahPardikes</dc:creator>
    <dc:date>2020-10-01T19:32:42Z</dc:date>
    <item>
      <title>What condition can I use to enable a button when a feature is selected?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/what-condition-can-i-use-to-enable-a-button-when-a/m-p/813746#M2448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have added a custom button to my config.daml file.&amp;nbsp; I only want this button to be enabled when there is a feature selected on the map.&amp;nbsp; Is there a way to be even more specific and enable only when a feature from a&amp;nbsp;certain&amp;nbsp;layer has been selected?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found this condition in the help files, but it enables the button when I select a layer in the Contents list:&lt;/P&gt;&lt;P&gt;condition="esri_mapping_onlyFeatureLayersSelectedCondition"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is not something already available, how would I create a condition to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;button id="ModifyAttributesButton"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;caption="Modify Attributes"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;className="TestProject.Buttons.ModifyAttributesButton"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;loadOnClick="true"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;smallImage="Images\16x16\ModifyAttributes16.png"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;largeImage="Images\32x32\ModifyAttributes.png"&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;tooltip heading="Tooltip Heading"&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Modify project attributes&amp;lt;disabledText /&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/tooltip&amp;gt;&lt;BR /&gt; &amp;lt;/button&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2020 18:03:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/what-condition-can-i-use-to-enable-a-button-when-a/m-p/813746#M2448</guid>
      <dc:creator>SarahPardikes</dc:creator>
      <dc:date>2020-10-01T18:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: What condition can I use to enable a button when a feature is selected?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/what-condition-can-i-use-to-enable-a-button-when-a/m-p/813747#M2449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved this - maybe there is a better way, but this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Module code, Initialize method, I subscribe to the selection event:&lt;BR /&gt; ArcGIS.Desktop.Mapping.Events.MapSelectionChangedEvent.Subscribe(MapSelectionChanged);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I can check the selected features for a selection made to my layer and activate the condition:&lt;/P&gt;&lt;P&gt;private void MapSelectionChanged(MapSelectionChangedEventArgs obj)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;FrameworkApplication.State.Activate("condition_is_project_selected");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (var item in obj.Selection)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (item.Key.ToString().Contains("Projects"))&lt;BR /&gt; &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;FrameworkApplication.State.Deactivate("condition_is_project_selected");&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2020 19:32:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/what-condition-can-i-use-to-enable-a-button-when-a/m-p/813747#M2449</guid>
      <dc:creator>SarahPardikes</dc:creator>
      <dc:date>2020-10-01T19:32:42Z</dc:date>
    </item>
  </channel>
</rss>

