共用方式為


Group Element (Ribbon)

Applies to: SharePoint Foundation 2010

Defines a group of controls.

<Group
  Command="Text"
  Description="Text"
  Id="Text"
  Image32by32Popup="Url"
  Image32by32PopupClass="CSS Class Selector"
  Image32by32PopupLeft="Negative Integer"
  Image32by32PopupTop="Negative Integer"
  Sequence="Integer"
  Template="Text"
  Title="Text"
/>

Attributes

Attribute

Description

Command

Optional. The value is used to enable or disable the controls in the group. If the Command attribute is present and has a value, the ribbon polls to see if the command is disabled. If it is disabled, the ribbon does not poll for any commands that are associated with the controls in the group; the controls are also effectively disabled.

Description

Optional. A description of the group.

Id

Required. A string that identifies the group, such as "Ribbon.DocLibListForm.Edit.Clipboard".

Image32by32Popup

Optional. A server-relative URL to a file that contains a 32-by-32-pixel image to be used to represent the group, such as "/_layouts/1033/images/formatmap32x32.png".

Image32by32PopupClass

Optional. The name of a CSS class selector to be applied to the image.

Image32by32PopupLeft

Optional. A negative integer that represents an offset for the left edge of the image. Use this attribute when the Image32by32Popup attribute points to an image file that contains images for many icons. The value of the Image32by32PopupLeft attribute is used to set the CSS left attribute for the inline style of an HTML img tag.

Image32by32PopupTop

Optional. A negative integer that represents an offset for the top edge of the image. Use this attribute when the Image32by32Popup attribute points to an image file that contains images for many icons. The value of the Image32by32PopupTop attribute is used to set the CSS top attribute for the inline style of an HTML img tag.

Sequence

Optional. An integer that specifies the order of placement among sibling XML nodes.

Template

Optional. A string that corresponds to the Id attribute of a GroupTemplate element.

Title

Optional. The text that is displayed as the group’s title on the ribbon and in the tooltip.

Child Elements

Controls

Parent Elements

CommandUIDefinition

Groups

Occurrences

Minimum: 0

Maximum: unbounded

Example

The following XML fragment defines a group that contains two buttons.

<Group
  Id="Ribbon.WikiPageTab.CustomGroup"
  Sequence="55"
  Description="Custom Group"
  Title="Custom"
  Command="EnableCustomGroup"
  Template="Ribbon.Templates.Flexible2">
  <Controls Id="Ribbon.WikiPageTab.CustomGroup.Controls">
    <Button
      Id="Ribbon.WikiPageTab.CustomGroup.CustomGroupHello"
      Command="CustomGroupHelloWorld"
      Image16by16="/_layouts/images/FILMSTRP.GIF"
      Image32by32="/_layouts/images/PPEOPLE.GIF"
      LabelText="Hello, World"
      TemplateAlias="o2"
      Sequence="15" />
    <Button
      Id="Ribbon.WikiPageTab.CustomGroup.CustomGroupGoodbye"
      Command="CustomGroupGoodbyeWorld"
      Image16by16="/_layouts/images/FILMSTRP.GIF"
      Image32by32="/_layouts/images/PPEOPLE.GIF"
      LabelText="Good-bye, World"
      TemplateAlias="o2"
      Sequence="18" />
  </Controls>
</Group>

See Also

Tasks

Walkthrough: Adding a Group to the Server Ribbon