<Grid Name="MapGrid" Grid.Row="0"> <Grid.Resources> <esriSymbols:SimpleMarkerSymbol x:Name="MyMarkerSymbol" Color="Green" Style="Diamond" Size="10" /> </Grid.Resources> <esri:Map x:Name="MyMap" Grid.RowSpan="2" > <esri:Map.Layers> <esri:ArcGISDynamicMapServiceLayer ID="SchoolSearch3" Url="http://198.182.104.173/ArcGIS/rest/services/SchoolSearch3/MapServer" VisibleLayers="0,1" /> <esri:FeatureLayer ID="MyFeatureLayer" Url="http://198.182.104.173/ArcGIS/rest/services/BikeCounts_Test/MapServer/0" MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp" DisableClientCaching="True" Mode="OnDemand" OutFields="*" SelectionColor="Yellow" FeatureSymbol="{StaticResource MyMarkerSymbol}" Where="1=1" /> </esri:Map.Layers> </esri:Map> </Grid>
I tried your code and it works fine for me except now the selection color is inoperative. How would you provide for that? Would I need another renderer with a different symbol?
The FeatureLayer's Renderer trumps FeatureSymbol. Since the service already defines a Renderer, the FeatureSymbol is ignored. The only way you can override the Renderer defined by the service is to create your own renderer.For example:Under Resources... <esri:SimpleRenderer x:Key="MyRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleMarkerSymbol Color="Red" Style="Circle" Size="10"/> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> FeatureLayer.. <esri:FeatureLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0" Renderer="{StaticResource MyRenderer}"/>
<esri:SimpleRenderer x:Key="MyRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleMarkerSymbol Color="Red" Style="Circle" Size="10"/> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer>
<esri:FeatureLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0" Renderer="{StaticResource MyRenderer}"/>
<Grid Name="MapGrid" Grid.Row="0"> <Grid.Resources> <esri:SimpleRenderer x:Key="MyRenderer"> <esri:SimpleRenderer.Symbol> <esriSymbols:SimpleMarkerSymbol x:Name="MyMarkerSymbol" Color="Green" Style="Diamond" Size="10" /> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </Grid.Resources> <esri:Map x:Name="MyMap" Grid.RowSpan="2" > <esri:Map.Layers> <esri:ArcGISDynamicMapServiceLayer ID="SchoolSearch3" Url="http://198.182.104.173/ArcGIS/rest/services/SchoolSearch3/MapServer" VisibleLayers="0,1" /> <esri:FeatureLayer ID="MyFeatureLayer" Url="http://198.182.104.173/ArcGIS/rest/services/BikeCounts_Test/MapServer/0" MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp" DisableClientCaching="True" Mode="OnDemand" OutFields="*" SelectionColor="Cyan" Renderer="{StaticResource MyRenderer}" Where="1=1" /> </esri:Map.Layers> </esri:Map> </Grid>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.