<?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: Remove graphics layer doesn't work in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107797#M7230</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your code removes selected elements of graphics layer. To remove graphics layer you need to remove map layer using&amp;nbsp;QueuedTask.Run like this :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView.Active.Map.RemoveLayer(graphicsLayer);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Oct 2021 05:15:21 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2021-10-15T05:15:21Z</dc:date>
    <item>
      <title>Remove graphics layer doesn't work</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107725#M7228</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;I'm trying to remove the graphics layer on map.&amp;nbsp; Codes did go through&lt;/P&gt;&lt;P&gt;&amp;nbsp;graphicsLayer.RemoveElements(graphicsLayer.GetSelectedElements());&lt;/P&gt;&lt;P&gt;but nothing happened.&amp;nbsp; My graphics layer is still there.&amp;nbsp; Am I missing something?&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; protected async override void OnClick()
    {
      //Get the graphics layer
      var graphicsLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;GraphicsLayer&amp;gt;().FirstOrDefault();
        await QueuedTask.Run(() =&amp;gt;
      {
          //Remove existing graphicsLayer
          if (graphicsLayer != null)
          {
              graphicsLayer.RemoveElements(graphicsLayer.GetSelectedElements());
          }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 22:12:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107725#M7228</guid>
      <dc:creator>LeLuong</dc:creator>
      <dc:date>2021-10-14T22:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Remove graphics layer doesn't work</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107797#M7230</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your code removes selected elements of graphics layer. To remove graphics layer you need to remove map layer using&amp;nbsp;QueuedTask.Run like this :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView.Active.Map.RemoveLayer(graphicsLayer);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 05:15:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107797#M7230</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-10-15T05:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove graphics layer doesn't work</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107976#M7239</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;.&amp;nbsp; I actually wanted to remove all elements.&amp;nbsp; I should use&lt;/P&gt;&lt;P&gt;graphicsLayer.RemoveElements(graphicsLayer.GetElements()); instead of&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;graphicsLayer.RemoveElements(graphicsLayer.GetSelectedElements());&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Oct 2021 15:47:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-graphics-layer-doesn-t-work/m-p/1107976#M7239</guid>
      <dc:creator>LeLuong</dc:creator>
      <dc:date>2021-10-15T15:47:52Z</dc:date>
    </item>
  </channel>
</rss>

