Search code examples
outlookoutlook-addinoutlook-2013

Outlook 2013 Addin: Change Ribbon Button Image on click of button using c#


I have created Ribbon button for Outlook 2013 using c#.

And i have also set image for the ribbon.

Now on click of Ribbon button i want to change Ribbon Image.

Is it possible to achieve this using c#.?


Solution

  • Not sure how exactly you want it to work, but this could do the trick.

    bool callback {get;set}
    
    public Bitmap GetImage(IRibbonControl control)
        {
            switch (control.Id)
            {
    
                case "FooButtonId":
                {
                    if(callback== true){
                        callback = false;
                        return new Bitmap(Properties.Resources.someimage1);
                    }else 
                        callback =true;
                        return new Bitmap(Properties.Resources.someimage2);
                    }
                }
            }
        }