<?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: How to display a custom label class for a feature layer in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1175922#M8161</link>
    <description>&lt;P&gt;As an fyi, I am able to get my labels to appear if I remove the layer from the map and then undo the operation to bring it back in the map.&amp;nbsp; Obviously this is not a solution, but just worth noting.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 14:30:05 GMT</pubDate>
    <dc:creator>DaveLewis73</dc:creator>
    <dc:date>2022-05-20T14:30:05Z</dc:date>
    <item>
      <title>How to display a custom label class for a feature layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1175654#M8154</link>
      <description>&lt;P&gt;I have an issue with labeling.&amp;nbsp; How do you set up a new label class for a feature layer and then set it to that layer to be viewed on the map? I have code that should work, but I can only create new label classes.&amp;nbsp; I am unable to properly associate them to my feature layer so that they can be seen.&amp;nbsp; As an fyi, I can check the label classes in the GUI and my new custom classes do show up.&amp;nbsp; The only way that I can see any labels though is to use the default label class.&amp;nbsp; I have deleted the default label class in the hopes that it will display my custom classes, but that doesn't work either.&amp;nbsp; Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;The following is my current code:&lt;/P&gt;&lt;P&gt;private void CreateLabelProperties(string className, System.Drawing.Color color, string whereClause = "")&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CIMColor annoColor = CIMColor.CreateRGBColor(color.R, color.G, color.B, 100);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CIMTextSymbol textSymbol = SymbolFactory.Instance.ConstructTextSymbol(annoColor, 12, "Arial", "Bold");&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CIMSymbolReference textSymRef = textSymbol.MakeSymbolReference();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CIMFeatureLayer layerDef = _gridLayer.GetDefinition() as CIMFeatureLayer;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; List&amp;lt;CIMLabelClass&amp;gt; listLabelClasses = new List&amp;lt;CIMLabelClass&amp;gt;();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (layerDef.LabelClasses?.Length &amp;gt; 0)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listLabelClasses = layerDef.LabelClasses.ToList();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CIMLabelClass labelClass;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (className == "Default")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass = layerDef.LabelClasses.ToList().FirstOrDefault();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass = new CIMLabelClass();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.Name = className;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.ExpressionEngine = LabelExpressionEngine.Arcade;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.Expression = string.Format("$feature.{0}", CellNameField);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.WhereClause = whereClause;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; labelClass.Visibility = true;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listLabelClasses.Add(labelClass);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; labelClass.TextSymbol = textSymRef;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CIMStandardLabelPlacementProperties standardLabelPlacementProps = new&amp;nbsp; &amp;nbsp; &amp;nbsp; CIMStandardLabelPlacementProperties&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FeatureType = LabelFeatureType.Polygon&lt;BR /&gt;&amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp; &amp;nbsp; labelClass.StandardLabelPlacementProperties = standardLabelPlacementProps;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; layerDef.LabelClasses = listLabelClasses.ToArray();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; _gridLayer.AddLabelClass(className);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; _gridLayer.SetDefinition(layerDef);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; _gridLayer.SetLabelVisibility(true);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 18:30:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1175654#M8154</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-05-19T18:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a custom label class for a feature layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1175922#M8161</link>
      <description>&lt;P&gt;As an fyi, I am able to get my labels to appear if I remove the layer from the map and then undo the operation to bring it back in the map.&amp;nbsp; Obviously this is not a solution, but just worth noting.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 14:30:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1175922#M8161</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-05-20T14:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a custom label class for a feature layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1176066#M8165</link>
      <description>&lt;P&gt;I figured out the issue with the labels.&amp;nbsp; For anyone who is interested, the problem deals with instantiating Maplex label placement properties.&amp;nbsp; The following code needed to be added for the labels to appear:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;CIMMaplexLabelPlacementProperties maplexLabelPlacementProps = new CIMMaplexLabelPlacementProperties
{
    FeatureType = LabelFeatureType.Polygon
};
labelClass.MaplexLabelPlacementProperties = maplexLabelPlacementProps;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 19:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-display-a-custom-label-class-for-a-feature/m-p/1176066#M8165</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-05-20T19:13:37Z</dc:date>
    </item>
  </channel>
</rss>

