0

i have developing outlook addin.i done to create a custom tab.it contains two buttons and i set a custom image successsfully.now my issue is i cant hide my button in my button click function.the ribbon and their button images are only load in ribbon load.i want to hide the first button and display the second button for after first button click.

<button id="btn1" onAction="Encrypt_Click" label="Encrypt" size="large" image="email-security.png" getVisible="Control_Visible"/>

 <button id="btn2" onAction="Decrypt_Click" label="Decrypt" size="large" image="email-security.png" getVisible="Decrypt_Visible" />

the functions are,

public bool Control_Visible(Office.IRibbonControl control)
        {

            cntrlID = control.Id;

            var windowType = Globals.ThisAddIn.Application.ActiveWindow();
            if (windowType is Outlook.Explorer)
            {

                return false;
            }
            else
            {
                if (flag == true)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }


        }


 public bool Decrypt_Visible(Office.IRibbonControl control)
        {


            var windowType = Globals.ThisAddIn.Application.ActiveWindow();
            if (windowType is Outlook.Explorer)
            {

                return true;
            }
            else
            {
                if (flag == true)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }


        }

the above two functions called by ribbon load only.i want to call the functions in button click functions.how to get Office.IRibbonControl control object value to call the Decrypt_Visible() in btn1_click function.

Arjun babu
  • 607
  • 2
  • 13
  • 42

1 Answers1

0

Just use ribbon.Invalidate() in btn1_click function. It calls getVisible (and other) callbacks for all controls.

anzood
  • 51
  • 1
  • 3