<sdl:MapTip> <StackPanel Margin="10"> <esriPrimitives:SymbolDisplay Symbol="{Binding Symbol}" /> <!-- Trying to get symbol displayed here --> <TextBlock Text="{Binding [sgnl_type_desc]}" FontWeight="Bold" FontSize="12" Foreground="Black" /> <TextBlock Text="{Binding [ENTY_NME]}" FontSize="10" Foreground="Black" /> </StackPanel> </sdl:MapTip>
<esriPrimitives:SymbolDisplay Symbol="{Binding Converter={StaticResource attributeToSymbolConverter}}" />
<esriPrimitives:SymbolDisplay Symbol="{Binding /, Converter={StaticResource attributeToSymbolConverter}}" />
public class AttributeToSymbolConverter : FrameworkElement, IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var dict = value as IDictionary<string, object>; if (dict != null && FeatureLayer != null && FeatureLayer.LayerInfo != null && FeatureLayer.LayerInfo.Renderer != null) { var graphic = new Graphic(); foreach (var d in dict) graphic.Attributes[d.Key] = d.Value; return FeatureLayer.LayerInfo.Renderer.GetSymbol(graphic); } return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } public static readonly DependencyProperty FeatureLayerProperty = DependencyProperty.Register("FeatureLayer", typeof(FeatureLayer), typeof(AttributeToSymbolConverter), null); public FeatureLayer FeatureLayer { get { return (FeatureLayer)GetValue(FeatureLayerProperty); } set { SetValue(FeatureLayerProperty, value); } } }
<!--Grid.Resources--> <local:AttributeToSymbolConverter x:Key="MyConverter" FeatureLayer="{Binding ElementName=MyMap, Path=Layers[CitiesFeatureLayer]}"/> <!--FeatureLayer.MapTip.StackPanel--> <esriPrimitives:SymbolDisplay Symbol="{Binding Converter={StaticResource MyConverter}}" />
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.