<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Placing label inside a polygon in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683908#M3488</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for all the replies.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ahigh2: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your method of doing it. It works nicely but I have a problem. If I will to shift the polygon or do some transformation, the label just stays there. I think the reason to it is its a different graphic from the GraphicsLayer perspectives.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;helyxsisltd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think I can use a map service as my data is dynamic. Users can create and edit the polygons on the maps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Apr 2013 00:36:57 GMT</pubDate>
    <dc:creator>StanleyHo</dc:creator>
    <dc:date>2013-04-17T00:36:57Z</dc:date>
    <item>
      <title>Placing label inside a polygon</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683905#M3485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have multiples polygons (all rectangles) in a map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I used SimpleFillSymbol to draw the polygon as it allows me to have different color for the border and fill.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I wasn't able to place labels in the polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any way to achieve the following?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- drawing the polygon with a color&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- filling the polygon with another different color&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- placing a label in the center of the polygon&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2013 01:20:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683905#M3485</guid>
      <dc:creator>StanleyHo</dc:creator>
      <dc:date>2013-04-12T01:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Placing label inside a polygon</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683906#M3486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could try the following to get a filled polygon with a centered label:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Create a polygon fill using a &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol.html" rel="nofollow noopener noreferrer" target="_blank"&gt;SimpleFillSymbol&lt;/A&gt;&lt;SPAN&gt; with the BorderBrush property set to the outline you wish to have and the Fill property set to the secondary color to fill the polygon with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Assuming your rectangle is an ESRI.ArcGIS.Client.Geometry.Polygon object, acquire the extent ESRI.ArcGIS.Client.Geometry.Envelope object and then call the GetCenter() method to get the MapPoint that represents the center of the envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Create an ESRI.ArcGIS.Client.Symbols.TextSymbol with geometry set at the centroid of the envelope acquired in step 2 and text poperties you choose.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;void labeledPolygon(ESRI.ArcGIS.Client.Geometry.Polygon inPolygon)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic polygonGraphic = new Graphic();
&amp;nbsp;&amp;nbsp;&amp;nbsp; SimpleFillSymbol fillSymbol = new SimpleFillSymbol()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BorderBrush = borderBrush,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fill = fillBrush
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygonGraphic.Symbol = fillSymbol;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygonGraphic.Geometry = inPolygon;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Envelope extentEnvelope = inPolygon.Extent;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapPoint centerPoint = extentEnvelope.GetCenter();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic textGraphic = new Graphic();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextSymbol textSymbol = new TextSymbol()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Text properties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; textGraphic.Symbol = textSymbol;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; textGraphic.Geometry = centerPoint;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add the two graphics to the map.
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It may be necessary to measure your string and offset by the length to effectively "center" the text.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683906#M3486</guid>
      <dc:creator>AaronHigh</dc:creator>
      <dc:date>2021-12-12T04:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Placing label inside a polygon</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683907#M3487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you were happy with a map service, then all the rendering and labelling would be done on the server and your WPF app simply displays the resulting image. If your data is static, you could even pre-prepare annotation layers to speed things up. Neither need preclude your providing the data as a feature service as well, but it depends what you're doing with it. If the data is highly dynamic and/or you are editing the data in the WPF app, then you'd want to think carefully about how such an implementation might (not?) work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively, would map-tips serve your needs? (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Adding_MapTips/017000000033000000/"&gt;http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Adding_MapTips/017000000033000000/&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 09:51:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683907#M3487</guid>
      <dc:creator>DavidMartin</dc:creator>
      <dc:date>2013-04-16T09:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Placing label inside a polygon</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683908#M3488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for all the replies.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ahigh2: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your method of doing it. It works nicely but I have a problem. If I will to shift the polygon or do some transformation, the label just stays there. I think the reason to it is its a different graphic from the GraphicsLayer perspectives.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;helyxsisltd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think I can use a map service as my data is dynamic. Users can create and edit the polygons on the maps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2013 00:36:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/placing-label-inside-a-polygon/m-p/683908#M3488</guid>
      <dc:creator>StanleyHo</dc:creator>
      <dc:date>2013-04-17T00:36:57Z</dc:date>
    </item>
  </channel>
</rss>

