Define ribbon commands
Note
This topic is about classic commands.
There is a new way to define commands. See Modern commanding overview (preview).
A Ribbon command creates a reusable definition that can be referenced by ribbon control elements.
Ribbon command elements
The <CommandDefinition>
element defines a command in the ribbon. The Id
attribute specifies a unique identifier for the command that can be referenced by ribbon control elements by using the Command
parameter.
A ribbon command defines three things:
Enable Rules: Specifies when a specific ribbon control is enabled.
Display Rules: Specifies when a specific ribbon element is visible.
Actions: Specifies what code executes when a ribbon control is used.
Important
All command definitions are downloaded to a user's computer so that they can be evaluated at run time. This means that a user without the privileges to see a particular control in the ribbon can use the browser View Source command, review the code, and determine that a control exists that isn't displayed to them.
See also
Customize commands and the ribbon
Use localized labels with Ribbons
Define Ribbon enable rules
Troubleshoot ribbon issues
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: