foreach (var result in e.IdentifyResults) { Symbol symbol = null; if (result.Feature.Geometry is MapPoint) symbol = this.LayoutRoot.Resources["RedMarkerSymbol"] as Symbol; else if (result.Feature.Geometry is Polyline) symbol = this.LayoutRoot.Resources["RedLineSymbol"] as Symbol; else if(result.Feature.Geometry is Polygon) symbol = this.LayoutRoot.Resources["RedFillSymbol"] as Symbol; }
If Marker and Line Symbol worked, then maybe the IdentifyResults.Feature is Point or Polyline geometry.
Maybe you can determine the geometry type before you set the symbol. Something like:foreach (var result in e.IdentifyResults) { Symbol symbol = null; if (result.Feature.Geometry is MapPoint) symbol = this.LayoutRoot.Resources["RedMarkerSymbol"] as Symbol; else if (result.Feature.Geometry is Polyline) symbol = this.LayoutRoot.Resources["RedLineSymbol"] as Symbol; else if(result.Feature.Geometry is Polygon) symbol = this.LayoutRoot.Resources["RedFillSymbol"] as Symbol; }
Yep you are correct i am using geomentary as Map point, but i don't want to use simplemarkersymbol. I need to use fill symbol.
If we have mappoint as geomentary then how can we use fill symbol. could you please guide me in this.
var env = new Envelope(point.X - 1000, point.Y - 1000, point.X + 1000, point.Y + 1000) { SpatialReference = point.SpatialReference }; graphic = new Graphic() { Geometry = env, Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol }; graphicsLayer.Graphics.Add(graphic);
If you want to use a fill symbol with a map point you have first to convert the map point to a polygon or envelope geometry (that support fill symbol).
Something like:var env = new Envelope(point.X - 1000, point.Y - 1000, point.X + 1000, point.Y + 1000) { SpatialReference = point.SpatialReference }; graphic = new Graphic() { Geometry = env, Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol }; graphicsLayer.Graphics.Add(graphic);
That being said I am not sure you need this conversion, if you are identifying 'States' or 'Counties' you shoud directly get polygon geometries.