<?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: Creating a background for GroupElement in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-a-background-for-groupelement/m-p/1296351#M9916</link>
    <description>&lt;P&gt;You might have already done this, but there is a utility called CIM Viewer that you can download from GitHub and builder:&amp;nbsp; &amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-cim-viewer" target="_blank"&gt;GitHub - Esri/arcgis-pro-sdk-cim-viewer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;using the CIM Viewer you can then examine the CIMGroupElement in order to come up with a programmatic approach:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1686070812300.png" style="width: 1370px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72485iBCE81C6E551B3144/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1686070812300.png" alt="Wolf_0-1686070812300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using the objects that i discovered using the CIMViewer i build the following code snippet that gets the CIM Group's graphic frame and changes the width and the color of the group's frame (name MyGroup).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class ChangeGroupElement : Button
{
  private static CIMColor Red = new CIMRGBColor
  {
    R = 255,
    G = 0,
    B = 0,
    Alpha = 100// 0 for transparent and 100 for opaque
  };
  private static CIMColor Black = new CIMRGBColor
  {
    R = 0,
    G = 0,
    B = 0,
    Alpha = 100// 0 for transparent and 100 for opaque
  };
  protected override async void OnClick()
  {
    // Find 'MyGroup' and make changes
    var layout = LayoutView.Active?.Layout;
    if (layout == null)
    {
      MessageBox.Show("No active layout view");
      return;
    }
    var grp = layout.FindElement("MyGroup");
    if (grp == null)
    {
      MessageBox.Show("MyGroup not found");
      return;
    }
    try
    {
      await QueuedTask.Run(() =&amp;gt;
      {
        var cimGrp = grp.GetDefinition() as CIMGroupElement;
        if (cimGrp != null)
        {
          // check the graphic frame (see CIMViewer)
          if (cimGrp.GraphicFrame != null)
          {
            // get the border symbol in the graphic frame
            var borderSym = cimGrp.GraphicFrame.BorderSymbol as CIMSymbolReference;
            if (borderSym != null &amp;amp;&amp;amp; borderSym.Symbol != null)
            {
              // the border symbol is comprised of SymbolLayers
              // ... change the first SymbolLayer which is a CIMSolidStroke
              var symbol = borderSym.Symbol as CIMLineSymbol;
              if (symbol.SymbolLayers != null)
              {
                var solidStroke = symbol.SymbolLayers.OfType&amp;lt;CIMSolidStroke&amp;gt;().FirstOrDefault();
                if (solidStroke != null)
                {
                  var width = solidStroke.Width + 1;
                  solidStroke.Color = width % 2 == 0 ? Red : Black;
                  solidStroke.Width = width;
                }
              }
            }
          }
          grp.SetDefinition(cimGrp);
        }
      });
    }
    catch (Exception ex)
    {
      MessageBox.Show(ex.ToString());
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2023 17:05:23 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2023-06-06T17:05:23Z</dc:date>
    <item>
      <title>Creating a background for GroupElement</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-a-background-for-groupelement/m-p/1295708#M9913</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm working on an add-in which creates several layout-elements, including a groupelement which contains some text and a scalebar.&amp;nbsp;I'm able to add background / outline for each of the elements in the group, but not on the group itself.&amp;nbsp; How do I do this? I can't see any methods or properties on the GroupElement-object, nor the CIM-definition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's how I've created the GroupElement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ElementInfo info = new ElementInfo();
  info.CornerRounding = 25;

GroupElement groupElement = ElementFactory.Instance.CreateGroupElement(
  elementContainer: Module1.layout,
  elements: elementList,
  elementName: "JSRMålestokkGruppe",
  groupElementInfo: info
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with this and point me in the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 08:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-a-background-for-groupelement/m-p/1295708#M9913</guid>
      <dc:creator>TorbjørnDalløkken2</dc:creator>
      <dc:date>2023-06-05T08:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a background for GroupElement</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-a-background-for-groupelement/m-p/1296351#M9916</link>
      <description>&lt;P&gt;You might have already done this, but there is a utility called CIM Viewer that you can download from GitHub and builder:&amp;nbsp; &amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-cim-viewer" target="_blank"&gt;GitHub - Esri/arcgis-pro-sdk-cim-viewer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;using the CIM Viewer you can then examine the CIMGroupElement in order to come up with a programmatic approach:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1686070812300.png" style="width: 1370px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72485iBCE81C6E551B3144/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1686070812300.png" alt="Wolf_0-1686070812300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using the objects that i discovered using the CIMViewer i build the following code snippet that gets the CIM Group's graphic frame and changes the width and the color of the group's frame (name MyGroup).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class ChangeGroupElement : Button
{
  private static CIMColor Red = new CIMRGBColor
  {
    R = 255,
    G = 0,
    B = 0,
    Alpha = 100// 0 for transparent and 100 for opaque
  };
  private static CIMColor Black = new CIMRGBColor
  {
    R = 0,
    G = 0,
    B = 0,
    Alpha = 100// 0 for transparent and 100 for opaque
  };
  protected override async void OnClick()
  {
    // Find 'MyGroup' and make changes
    var layout = LayoutView.Active?.Layout;
    if (layout == null)
    {
      MessageBox.Show("No active layout view");
      return;
    }
    var grp = layout.FindElement("MyGroup");
    if (grp == null)
    {
      MessageBox.Show("MyGroup not found");
      return;
    }
    try
    {
      await QueuedTask.Run(() =&amp;gt;
      {
        var cimGrp = grp.GetDefinition() as CIMGroupElement;
        if (cimGrp != null)
        {
          // check the graphic frame (see CIMViewer)
          if (cimGrp.GraphicFrame != null)
          {
            // get the border symbol in the graphic frame
            var borderSym = cimGrp.GraphicFrame.BorderSymbol as CIMSymbolReference;
            if (borderSym != null &amp;amp;&amp;amp; borderSym.Symbol != null)
            {
              // the border symbol is comprised of SymbolLayers
              // ... change the first SymbolLayer which is a CIMSolidStroke
              var symbol = borderSym.Symbol as CIMLineSymbol;
              if (symbol.SymbolLayers != null)
              {
                var solidStroke = symbol.SymbolLayers.OfType&amp;lt;CIMSolidStroke&amp;gt;().FirstOrDefault();
                if (solidStroke != null)
                {
                  var width = solidStroke.Width + 1;
                  solidStroke.Color = width % 2 == 0 ? Red : Black;
                  solidStroke.Width = width;
                }
              }
            }
          }
          grp.SetDefinition(cimGrp);
        }
      });
    }
    catch (Exception ex)
    {
      MessageBox.Show(ex.ToString());
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 17:05:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-a-background-for-groupelement/m-p/1296351#M9916</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2023-06-06T17:05:23Z</dc:date>
    </item>
  </channel>
</rss>

