Hello there
I am trying to implement a Ribbon group with one or two custom buttons. My buttons should be enabled whenever files are selected in the files view, and disabled when no files have been selected.
It should thereby be similar to to the Open for Translation button, which is grayed out when no files are selected.
The Enabled property of a button can be set to true/false. In the SDK there is a view parts sample that involves a GetFilesController().SelectedFilesChanged += OnSelectedFilesChanged event.
However, I cannot manage to apply this to my implementation of a ribbon group. Am I trying in vain, or is that something that should work?
[RibbonGroupLayout(LocationByType = typeof(TranslationStudioDefaultRibbonTabs.HomeRibbonTabLocation))]
class MySampleRibbonGroup : AbstractRibbonGroup
{
}
[Action("test", Icon = "test_Icon")]
[ActionLayout(typeof(MySampleRibbonGroup), 10, DisplayType.Large)]
[Shortcut(Keys.Control | Keys.Alt | Keys.M)]
public class MyMainIconActionMaster : AbstractViewControllerAction<FilesController>
{
protected override void Execute()
{
// do something
}
}