The simple answer is: You can't.The workaround is to create a point graphic on top of the polygon and use a TextMarkerSmbol for it.
<Grid.Resources> <esriSymbols:TextSymbol x:Name="LegendTextSymbol"> <esriSymbols:TextSymbol.ControlTemplate> <ControlTemplate> <Border Padding="10,5,10,5" Background="White" BorderBrush="Black"> <TextBlock FontSize="{Binding Symbol.Size}" Text="{Binding Symbol.Text}" Foreground="Blue" FontFamily="{Binding Symbol.FontFamily}" HorizontalAlignment="Center" /> </Border> </ControlTemplate> </esriSymbols:TextSymbol.ControlTemplate> </esriSymbols:TextSymbol> </Grid.Resources>
_featureLayer.UpdateCompleted += (sender, args) => { _graphicsLayer.Graphics.Clear(); foreach (var graphic in _featureLayer.Graphics) { var textSymbol = new TextSymbol(); textSymbol.ControlTemplate = LegendTextSymbol.ControlTemplate; textSymbol.Text = graphic.Attributes["NAME"] as string; var textGraphic = new Graphic() { Geometry = new MapPoint(graphic.Geometry.Extent.XMax, graphic.Geometry.Extent.YMax), Symbol = textSymbol }; _graphicsLayer.Graphics.Add(textGraphic); } };
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.