Use the FeatureSymbol attribute of the FeatureLayer.http://help.arcgis.com/en/webapi/silverlight/help/index.html
However, after trying around I still could find out how to use the FeatureSymbol property. It is in Symbol class of ESRI.ArcGIS.Client.Symbols Namespace, I don't know how to put it into the StackPanel and arrange it with other controls such as text blocks and checkboxes.
<Grid x:Name="LayoutRoot" > <Grid.Resources> <esri:FillSymbol x:Name="FillSymbol" Fill="Yellow" /> <esri:SimpleMarkerSymbol x:Name="MarkerSymbol0" Color="Brown" Style="Circle" /> <esri:SimpleMarkerSymbol x:Name="MarkerSymbol1" Color="BlueViolet" Style="Circle"/> </Grid.Resources> <esri:Map x:Name="MyMap" Extent="-120,20,-90,60"> <esri:Map.Layers> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> <esri:FeatureLayer ID="Warning" FeatureSymbol="{StaticResource FillSymbol}" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyFeedSample/MapServer/2"/> <esri:FeatureLayer ID="Wind" FeatureSymbol="{StaticResource MarkerSymbol0}" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyFeedSample/MapServer/0"/> <esri:FeatureLayer ID="Stream Gauges" FeatureSymbol="{StaticResource MarkerSymbol1}" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyFeedSample/MapServer/1"/> </esri:Map.Layers> </esri:Map> <Border Background="#77919191" BorderThickness="1" CornerRadius="5" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20" Padding="5" BorderBrush="Black" > <ListBox x:Name="MyList" ItemsSource="{Binding ElementName=MyMap, Path=Layers}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <!--Layer visibility checkbox--> <CheckBox IsChecked="{Binding Visible, Mode=TwoWay}" /> <!-- Symbol --> <esriPrimitives:SymbolDisplay Symbol="{Binding FeatureSymbol}" Margin="5,0,0,0" Height="18" Width="25" VerticalAlignment="Center" HorizontalAlignment="Center"/> <!--Opacity slider--> <Slider Margin="0,0,0,0" Minimum="0" Maximum="1" Width="30" Value="{Binding Opacity, Mode=TwoWay}" Height="18" /> <!--Layer name--> <TextBlock Text="{Binding ID, Mode=OneWay}" Margin="5,0,0,0" > <!-- Tooltip on hover--> <ToolTipService.ToolTip> <StackPanel MaxWidth="400"> <TextBlock FontWeight="Bold" Text="{Binding CopyrightText}" TextWrapping="Wrap" /> <TextBlock Text="{Binding Description}" TextWrapping="Wrap" /> </StackPanel> </ToolTipService.ToolTip> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Border> �?? �?? </Grid>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.