<?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 Changing Ribbon Icon at Runtime in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/changing-ribbon-icon-at-runtime/m-p/1510914#M11910</link>
    <description>&lt;P&gt;Hello, is there any way to change an icon on the ribbon at runtime? For example, if a state or condition changes, can i also change the picture that shows up on the ribbon?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2024 22:14:55 GMT</pubDate>
    <dc:creator>khamillejaynes20</dc:creator>
    <dc:date>2024-07-26T22:14:55Z</dc:date>
    <item>
      <title>Changing Ribbon Icon at Runtime</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/changing-ribbon-icon-at-runtime/m-p/1510914#M11910</link>
      <description>&lt;P&gt;Hello, is there any way to change an icon on the ribbon at runtime? For example, if a state or condition changes, can i also change the picture that shows up on the ribbon?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 22:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/changing-ribbon-icon-at-runtime/m-p/1510914#M11910</guid>
      <dc:creator>khamillejaynes20</dc:creator>
      <dc:date>2024-07-26T22:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Ribbon Icon at Runtime</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/changing-ribbon-icon-at-runtime/m-p/1511203#M11911</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For Button or MapTool you can override OnUpdate method:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;        protected override void OnUpdate()
        {
                if (myCondition)
                {
                    Caption = "Title1";
                    SmallImage = BuildImage("small_image1.png");
                    LargeImage = BuildImage("large_image1.png");
                }
                else
                {
                    Caption = "Title2";
                    SmallImage = BuildImage("small_image2.png");
                    LargeImage = BuildImage("large_image2.png");
                }
        }
&lt;/LI-CODE&gt;&lt;P&gt;Or set from code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void ChangeCaptionImage()
{
  IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("MyAddin_MyCustomButton");
  if (wrapper != null)
  {
    wrapper.Caption = "new caption";

    // ensure that T-Rex16 and T-Rex32 are included in your add-in under the images folder and have 
    // BuildAction = Resource and Copy to OutputDirectory = Do not copy
    wrapper.SmallImage = BuildImage("T-Rex16.png");
    wrapper.LargeImage = BuildImage("T-Rex32.png");
  }
}

private ImageSource BuildImage(string imageName)
{
  return new BitmapImage(PackUriForResource(imageName));
}

private Uri PackUriForResource(string resourceName)
{
  string asm = System.IO.Path.GetFileNameWithoutExtension(
      System.Reflection.Assembly.GetExecutingAssembly().Location);
  return new Uri(string.Format("pack://application:,,,/{0};component/Images/{1}", asm, resourceName), UriKind.Absolute);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 28 Jul 2024 15:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/changing-ribbon-icon-at-runtime/m-p/1511203#M11911</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-07-28T15:55:27Z</dc:date>
    </item>
  </channel>
</rss>

