Select to view content in your preferred language

Setting tooltip on ribbon tool from code

463
0
03-20-2013 01:07 PM
PhilippeSteinthal1
Deactivated User
When my tool is disabled I need to change the tooltip to explain to the user why the tool cannot be used but setting the description attribute does not seem to work.
Here is my code:

[DisplayName("My name")]
[ESRI.ArcGIS.Client.Extensibility.Description("My tooltip")]
public class MyToolCommand : ICommand
...

public bool CanExecute(object parameter)
{
   bool ok=true;
   if (!MapApplication.Current.IsEditMode)
    {
     //tool needs to be disabled for some application reason
     ok=false;

    ESRI.ArcGIS.Client.Extensibility.DescriptionAttribute descriptionAttribute = (ESRI.ArcGIS.Client.Extensibility.DescriptionAttribute)Attribute.GetCustomAttribute(typeof(MyToolCommand ), typeof(ESRI.ArcGIS.Client.Extensibility.DescriptionAttribute));
       //change tool tip
      descriptionAttribute.Description = "My new tool tip";


    }
return ok;
}

Thanks
0 Kudos
0 Replies