Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1850
SharedProps.Enabled doesn't work
posted

The code below should be working for SharedProps.Enabled but it doesn't. I think this is a bug in the latest Ribbon code. I have two examples below and neither work. Ideas? Help?


Example One:
PopupMenuTool popupAnalysisInstance = mainRibbon.Ribbon.Tabs["Sales"].Groups["reports"].Tools["PopupAnalysis"] as PopupMenuTool;
           
bool showTool = false;

try
{
   showTool = ReportUtils.AuthorizeUserForReport(
          UserManager.Instance.RunAsUser.SamAccountName,
          reportToolMap[reportToolKey]);
}
catch (Exception) { }
               
popupAnalysisInstance.Tools[reportToolKey].SharedProps.Enabled = showTool; //Setting Enable doesn't work...why?

popupAnalysisInstance.Tools[reportToolKey].SharedProps.Visible= showTool;  //Setting visible does work....Why??



Example Two:
ButtonTool aTool = mainRibbon.Tools[reportToolKey] as ButtonTool;
            
if (aTool != null)
{
    bool showTool = false;
    try
    {
      showTool = ReportUtils.AuthorizeUserForReport(
           UserManager.Instance.RunAsUser.SamAccountName,
           reportToolMap[reportToolKey]);
     }
     catch (Exception) { }
               
   aTool.SharedProps.Enabled = showTool; //This doesn't work...Why??
   aTool.SharedProps.Visible = showTool; //This does work
}