laptop and a wrench

Bug

ElementGraphicsLayer cannot be turned off/on using Visible property.

Last Published: August 25, 2014 No Product Found
Bug ID Number NIM012801
SubmittedNovember 2, 2007
Last ModifiedApril 7, 2025
Applies toNo Product Found
Version found9.2
Program languageC#
StatusWill Not Be Addressed

Additional Information

No Public Explanation

Workaround

Rex suggested the following workaroundsThis is appears to be a bug with ElementGraphicsLayer… I would log it when you get the chance. There are three workarounds at the moment.. all are listed below with some example code. 1) If you need to use an ElementGraphicsLayer, set the SelectedRenderer on each GeometryElement to use a transparent symbol. Then change the value in the IS_SELECTED column to true (not visible) or false (visible). ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol simpleFillSymbol1 = new ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol(); simpleFillSymbol1.Color = System.Drawing.Color.Transparent; simpleFillSymbol1.BoundaryWidth = 0; graphicElement.SelectedSymbol = simpleFillSymbol1; DataRow dataRow = elementGraphicsLayer.Add(graphicElement); dataRow["IS_SELECTED"] = false;2) Set the visibility for the map resource item associated with the graphics map resource Map1.MapResourceManagerInstance.ResourceItems.Find(adfGraphicsMapFunctionality.Resource).DisplaySettings.Visible = false;3) Create a FeatureGraphicsLayer and change its visibility via the Visible property. public void AddGraphicData() { ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality adfGraphicsMapFunctionality = null; foreach (ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality mapFunctionality in Map1.GetFunctionalities()) { // If multiple graphics resources are available, use the resource name to distinguish if (mapFunctionality.Resource.Name == "ADFGraphicsResource") { adfGraphicsMapFunctionality = mapFunctionality as ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality; break; } } if (adfGraphicsMapFunctionality == null) return; // Add a new ElementGraphicsLayer ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer elementGraphicsLayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer(); elementGraphicsLayer.TableName = "Element Graphics - Extent Rectangle"; // Add graphics layer to map functionality graphics dataset ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicsDataSet graphicsDataSet = adfGraphicsMapFunctionality.GraphicsDataSet; graphicsDataSet.Tables.Add(elementGraphicsLayer); ESRI.ArcGIS.ADF.Web.Geometry.Polygon adfPolygon = new ESRI.ArcGIS.ADF.Web.Geometry.Polygon(); adfPolygon.Rings.Add(new ESRI.ArcGIS.ADF.Web.Geometry.Ring (new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-100, 20, -80, 40))); ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol(); simpleFillSymbol.Transparency = 0; simpleFillSymbol.FillType = ESRI.ArcGIS.ADF.Web.Display.Symbol.PolygonFillType.FDiagonal; simpleFillSymbol.BoundaryColor = System.Drawing.Color.Red; ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement graphicElement = new ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement(adfPolygon, simpleFillSymbol); elementGraphicsLayer.Add(graphicElement); elementGraphicsLayer.Visible = false; // Add a new FeatureGraphicsLayer ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer featureGraphicsLayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer(); featureGraphicsLayer.TableName = "Feature Graphics - Extent Rectangle"; // Add graphics layer to map functionality graphics dataset graphicsDataSet.Tables.Add(featureGraphicsLayer); ESRI.ArcGIS.ADF.Web.Geometry.Polygon adfPolygon2 = new ESRI.ArcGIS.ADF.Web.Geometry.Polygon(); adfPolygon2.Rings.Add(new ESRI.ArcGIS.ADF.Web.Geometry.Ring (new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-70, 20, -50, 40))); ESRI.ArcGIS.ADF.Web.Display.Renderer.SimpleRenderer simpleRenderer = new ESRI.ArcGIS.ADF.Web.Display.Renderer.SimpleRenderer(); simpleRenderer.Symbol = simpleFillSymbol; featureGraphicsLayer.Renderer = simpleRenderer; featureGraphicsLayer.Add(adfPolygon2); }

Steps to Reproduce

Bug ID: NIM012801

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options