Add Symbol resources to the map in Sliverlight

Source: Internet
Author: User

Add two layers to the map as follows:
Add a multilateral row to the Graphics layer, but the Symbol attribute is not set for the multilateral row.
Symbol = "{StaticResource Symbol2 }"

<Esri: Map Background = "White">
<Esri: ArcGISTiledMapServiceLayer ID = "PhysicalTiledLayer"
Url = "http://services.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer">
</Esri: ArcGISTiledMapServiceLayer>
<Esri: GraphicsLayer ID = "MyGraphics">
<Esri: GraphicsLayer. Graphics>
<Esri: Graphic>
<EsriGeometry: Polygon>
<EsriGeometry: Polygon. Rings>
<EsriGeometry: PointCollection>
<EsriGeometry: MapPoint X = "110.039" Y = "-20.303"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "132.539" Y = "-7.0137"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "153.281" Y = "-13.923"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "162.773" Y = "-35.174"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "133.594" Y = "-43.180"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "111.797" Y = "-36.032"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "110.039" Y = "-20.303"> </esriGeometry: MapPoint>
</EsriGeometry: PointCollection>
</EsriGeometry: Polygon. Rings>
</EsriGeometry: Polygon>
</Esri: Graphic>
</Esri: GraphicsLayer. Graphics>
</Esri: GraphicsLayer>
</Esri: Map>

In this case, we need to create a Symbol resource, which is slow in manual writing and prone to errors. Fortunately, Expression Blend provides us with convenience.
We establish the Symbol resources in a visualized manner. The final code is as follows:

<UserControl
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: d = "http://schemas.microsoft.com/expression/blend/2008"
Xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
Mc: Ignorable = "d"
Xmlns: esri = "clr-namespace: ESRI. ArcGIS. Client; assembly = ESRI. ArcGIS. Client"
Xmlns: esriSymbols = "clr-namespace: ESRI. ArcGIS. Client. Symbols; assembly = ESRI. ArcGIS. Client"
Xmlns: esriGeometry = "clr-namespace: ESRI. ArcGIS. Client. Geometry; assembly = ESRI. ArcGIS. Client"
X: Class = "ArcGISSLSDK_Graphics.UserControl1"
D: DesignWidth = "640" d: DesignHeight = "480">
<UserControl. Resources>
<EsriSymbols: FillSymbol x: Key = "F"> </esriSymbols: FillSymbol>
<EsriSymbols: FillSymbol x: Key = "Symbol1" BorderThickness = "2" Fill = "Red">
</EsriSymbols: FillSymbol>
<EsriSymbols: FillSymbol x: Key = "Symbol2" BorderThickness = "3" BorderBrush = "Red">
<EsriSymbols: FillSymbol. Fill>
<LinearGradientBrush EndPoint = "0.5, 1" StartPoint = "0.5, 0">
<GradientStop Color = "Black" Offset = "0"/>
<GradientStop Color = "# FFB3D65F" Offset = "1"/>
</LinearGradientBrush>
</EsriSymbols: FillSymbol. Fill>
</EsriSymbols: FillSymbol>
</UserControl. Resources>
 

<Grid x: Name = "LayoutRoot">
<Esri: Map Background = "White">
<Esri: ArcGISTiledMapServiceLayer ID = "PhysicalTiledLayer"
Url = "http://services.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer">
</Esri: ArcGISTiledMapServiceLayer>

<Esri: GraphicsLayer ID = "MyGraphics">
<Esri: GraphicsLayer. Graphics>

<Esri: Graphic Symbol = "{StaticResource Symbol1}">
<EsriGeometry: MapPoint X = "-10.609" Y = "23.729"/>
</Esri: Graphic>

<Esri: Graphic Symbol = "{StaticResource Symbol2}">
<EsriGeometry: Polygon>
<EsriGeometry: Polygon. Rings>
<EsriGeometry: PointCollection>
<EsriGeometry: MapPoint X = "110.039" Y = "-20.303"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "132.539" Y = "-7.0137"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "153.281" Y = "-13.923"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "162.773" Y = "-35.174"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "133.594" Y = "-43.180"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "111.797" Y = "-36.032"> </esriGeometry: MapPoint>
<EsriGeometry: MapPoint X = "110.039" Y = "-20.303"> </esriGeometry: MapPoint>
</EsriGeometry: PointCollection>
</EsriGeometry: Polygon. Rings>
</EsriGeometry: Polygon>
</Esri: Graphic>
</Esri: GraphicsLayer. Graphics>
</Esri: GraphicsLayer>
</Esri: Map>
</Grid>
</UserControl>

The procedure is as follows: select the map control and find the attribute panel, for example:

Find the... following layers under Map Settings. The following dialog box is displayed:

Select GraphicsLayer. The following dialog box is displayed:

Click the dialog box after Graphics, and set it as a resource in the dialog box that appears.

The final running result is:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.