<?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: Toggle visibility of graphic in GraphicsLayer in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92942#M2309</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks Andrew.&amp;nbsp; However, there are a few cases in our app where we would like to toggle the visibility of an individual graphic within a GraphicsLayer and not the visiblity of the entire GraphicsLayer.&amp;nbsp; Is there a way to do this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you could do is loop through all of the graphics in your graphics layer and when you find the one you want to toggle (based on a specific attribute for instance) you could change it's symbology to transparent.&amp;nbsp; Then to toggle it back on, iterate through your graphics in your Graphics Layer again, and change it's symbology back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for each gr as graphic in trycast(map.layers("MyGraphicsLayer"),graphicslayer) &amp;nbsp;&amp;nbsp;&amp;nbsp; if gr.Attributes("NAME") = "TargetGraphic" Then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if checkbox.isChecked = true then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gr.symbol = CType(LayoutRoot.Resources("TransparentSymbol"),ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gr.symbol = CType(LayoutRoot.Resources("DefaultSymbol"),ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if next&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Mar 2012 14:48:40 GMT</pubDate>
    <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
    <dc:date>2012-03-09T14:48:40Z</dc:date>
    <item>
      <title>Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92939#M2306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to toggle the visibility of a graphic in a GraphicsLayer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 13:17:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92939#M2306</guid>
      <dc:creator>KiaPierce</dc:creator>
      <dc:date>2012-03-09T13:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92940#M2307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;GraphicsLayer has a visible property.&amp;nbsp; You could bind the visibility to a checkbox or whatever control you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.GraphicsLayer_members.html"&gt;http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.GraphicsLayer_members.html&lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 13:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92940#M2307</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2012-03-09T13:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92941#M2308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Andrew.&amp;nbsp; However, there are a few cases in our app where we would like to toggle the visibility of an individual graphic within a GraphicsLayer and not the visiblity of the entire GraphicsLayer.&amp;nbsp; Is there a way to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 13:44:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92941#M2308</guid>
      <dc:creator>KiaPierce</dc:creator>
      <dc:date>2012-03-09T13:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92942#M2309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks Andrew.&amp;nbsp; However, there are a few cases in our app where we would like to toggle the visibility of an individual graphic within a GraphicsLayer and not the visiblity of the entire GraphicsLayer.&amp;nbsp; Is there a way to do this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you could do is loop through all of the graphics in your graphics layer and when you find the one you want to toggle (based on a specific attribute for instance) you could change it's symbology to transparent.&amp;nbsp; Then to toggle it back on, iterate through your graphics in your Graphics Layer again, and change it's symbology back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for each gr as graphic in trycast(map.layers("MyGraphicsLayer"),graphicslayer) &amp;nbsp;&amp;nbsp;&amp;nbsp; if gr.Attributes("NAME") = "TargetGraphic" Then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if checkbox.isChecked = true then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gr.symbol = CType(LayoutRoot.Resources("TransparentSymbol"),ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gr.symbol = CType(LayoutRoot.Resources("DefaultSymbol"),ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if next&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 14:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92942#M2309</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2012-03-09T14:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92943#M2310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Awesome. Thanks Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 12:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92943#M2310</guid>
      <dc:creator>KiaPierce</dc:creator>
      <dc:date>2012-03-13T12:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92944#M2311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Type typeInQuestion = typeof(Graphic);&lt;/P&gt;&lt;P&gt;PropertyInfo field = typeInQuestion.GetProperty("Visibility", BindingFlags.NonPublic | BindingFlags.Instance);&lt;/P&gt;&lt;P&gt;field.SetValue(graphic, Visibility.Collapsed);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 23:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92944#M2311</guid>
      <dc:creator>MaximMikhisor</dc:creator>
      <dc:date>2014-10-13T23:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92945#M2312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Maxim: Note that changing internal properties through reflection can cause a lot of problems - You're really pulling the rug out under the SDK. Also not that these internals might not be available in future updates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 23:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92945#M2312</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2014-10-14T23:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle visibility of graphic in GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92946#M2313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I could be wrong but if a GraphicsLayer is using a Renderer, then an individual graphic's symbol property will be null (or maybe it has changed or even "fixed" if that wasn't ESRI's original intention) so the method you suggest may not always be applicable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, I found this on another post somewhere and it works great.&amp;nbsp; Basically, setting the geometry to null hides the symbol.&amp;nbsp; This also doesn't require any reflection; it's pure OO inheritance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14134757131529097" jivemacro_uid="_14134757131529097"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Public Class ExtendedGraphic&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits ESRI.ArcGIS.Client.Graphic&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private _storedGeometry As ESRI.ArcGIS.Client.Geometry.Geometry&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Property Visible() As Boolean&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Me.Geometry IsNot Nothing&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set(ByVal value As Boolean)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If value &amp;lt;&amp;gt; Visible Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; If value Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _storedGeometry IsNot Nothing Then Me.Geometry = _storedGeometry&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; Else&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.Geometry IsNot Nothing Then _storedGeometry = Me.Geometry&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Geometry = Nothing&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; End If&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Set&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;End Class&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:04:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/toggle-visibility-of-graphic-in-graphicslayer/m-p/92946#M2313</guid>
      <dc:creator>LanceCrumbliss</dc:creator>
      <dc:date>2014-10-16T16:04:06Z</dc:date>
    </item>
  </channel>
</rss>

