I'm building a custom content editor button which will issue a command passing the ID of the selected item. Is there a way to enable/disable my button based on the template of the selected item. I want my command to only be run-able for items of a specific template. Obviously I could simply check the template ID of the item within my command handler code (which I will do anyway) but I would like to make this a bit more user-friendly.
As a (sort of similar) example, if you select an item with no children, the delete-subitems button under the main delete button disappears. I couldn't see any obvious mechanism about how this works though.