Hi all,I am using this method to add symbol on the map. Basically, it is binding size and color attributes to the graphic. The attributes value are gained from combox in the user_interface. The user can choose the size and color of the symbol.
<esri:SimpleMarkerSymbol x:Key="AddSymbolStar" Style="Cross"
Size="{Binding Attribute[Size]}"
Color="{Binding Attribute[Color]}" >
</esri:SimpleMarkerSymbol>
drawMode = DrawMode.Point;
GraphicsLayer graphicsLayer = MyMap.Layers["MyAddSymbolLayer"] as GraphicsLayer;
ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
{
Geometry = e.MapPoint,
Symbol = LayoutRoot.Resources["AddSymbolStar"] as ESRI.ArcGIS.Client.Symbols.Symbol
};
graphic.Attributes["Size"] = AddSymbolSizeCombo.SelectedItem.ToString();
MessageBox.Show("size" + graphic.Attributes["Size"]);
graphic.Attributes["Color"] = AddSymbolColorCombo.SelectedItem.ToString();
MessageBox.Show("color" + graphic.Attributes["Color"]);
graphicsLayer.Graphics.Add(graphic);
MessageBox.Show(graphicsLayer.Graphics.Count.ToString());
But weird thing is after I click on the map, the three message boxes all have values (size16, colorRed, 1), but there is no cross symbol appear on the map....I am not sure whether this binding attribute method can be only used in control template, cuz last time when I try to use the same method to add text on the map, I changed the control template of textblock. So....any suggestions? Thank you very much!!