Partilhar via


GalleryButton Element (Group)

Applies to: SharePoint Foundation 2010

Defines a gallery button.

<GalleryButton
  Alt="Text"
  Command="Text"
  CommandPreview="Text"
  CommandRevert="Text"
  CommandType="General | OptionSelect | IgnoredByMenu"
  CommandValueId="Text"
  ElementDimensions="Size16by16 | Size32by32 | Size48by48 | Size72by96 | Size96by72 | Size96by96 | Size128by128 | Size190by30 | Size190by40 | Size190by50 | Size190by60"
  Id="Text"
  Image="Url"
  ImageClass="CSS Selector"
  ImageLeft="Negative Integer"
  ImageTop="Negative Integer"
  InnerHTML="HTML"
  MenuItemId="Text"
  QueryCommand="Text"
  Sequence="Integer"
  TemplateAlias="Text"
  ToolTipImage32by32="Url"
  ToolTipImage32by32Class="CSS Selector"
  ToolTipImage32by32Left="Negative Integer"
  ToolTipImage32by32Top="Negative Integer"
  ToolTipTitle="Text"
  ToolTipDescription="Text"
  ToolTipHelpKeyWord="Text"
  ToolTipShortcutKey="Text"
/>

Attributes

Attribute

Description

Alt

Optional. Alternative text that is used for the control.

Command

Optional. The name of the command to execute when the control is clicked. If the control is in a CommandUIDefinition element, the value of the Command attribute of the control should be the same as the value of the Command attribute of a corresponding CommandUIHandler element.

CommandPreview

Optional. The name of the command to execute for previewing a selection.

CommandRevert

Optional. The name of the command to execute to return to the state that existed before previewing a selection.

CommandType

Optional. An enumeration value that specifies the type of command.

  • General. Not a specific type of command.

  • OptionSelection. A command that is generated when a user selects one option in an option group.

  • IgnoredByMenu. A command that is used for controls that should not close the menu when they are clicked.

CommandValueId

Optional. A string that is sent with the command event when the button is clicked.

ElementDimensions

Required. An enumeration value that specifies the dimensions of the rectangle in which the button is rendered. Dimensions are in pixels and are in the format "width by height".

  • Size16by16

  • Size32by32

  • Size48by48

  • Size72by96

  • Size96by72

  • Size96by96

  • Size128by128

  • Size190by30

  • Size190by40

  • Size190by50

  • Size190by60

Id

Required. A string that identifies the element, such as "buttonStaticStyle1".

Image

Optional. A server-relative URL to a file that contains an image to be used as an icon.

If an Image attribute is not defined, an InnerHTML attribute must be defined.

ImageClass

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

ImageLeft

Optional. A negative integer that represents an offset for the left edge of the image. Use this attribute when the Image attribute points to an image file that contains images for several icons.

ImageTop

Optional. A negative integer that represents an offset for the top edge of the image. Use this attribute when the Image attribute points to an image file that contains images for several icons.

InnerHTML

Optional. HTML markup that illustrates the choice that the button represents.

If the InnerHTML attribute is not defined, the Image attribute must be defined.

MenuItemId

Optional. A string that identifies the menu item where the button is located.

QueryCommand

Optional. The name of the command to execute when polling for state information.

Sequence

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

TemplateAlias

Optional. A string that matches the value of the TemplateAlias attribute for a ControlRef element, an OverflowArea element, or an OverflowSection element in a GroupTemplate element. The TemplateAlias attribute is used to size and position controls within a group when a template is applied to the group.

ToolTipImage32by32

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

ToolTipImage32by32Class

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

ToolTipImage32by32Left

Optional. A negative integer that represents an offset for the left edge of the image. Use this attribute when the ToolTipImage32by32 attribute points to an image file that contains the images for many icons. The value of the ToolTipImage32by32Left attribute is used to set the CSS left attribute when the page is created.

ToolTipImage32by32Top

Optional. A negative integer that represents an offset for the top edge of the image. Use this attribute when the ToolTipImage32by32 attribute points to an image file that contains the images for many icons. The value of the ToolTipImage32by32Top attribute is used to set the CSS top attribute when the page is created.

ToolTipTitle

Optional. The text that appears as the title of the tooltip.

ToolTipDescription

Optional. The text that appears in the body of the tooltip.

ToolTipHelpKeyWord

Optional. The keyword that is used by context-sensitive Help.

ToolTipShortcutKey

Optional. The text to display for the shortcut key in the tooltip. For example, if the shortcut key for the control is ALT + J, the value for this attribute is "ALT + J". The tooltip will display the text for the shortcut key in parentheses after the tooltip title: "(ALT + J)".

Child Elements

None

Parent Elements

CommandUIDefinition

Controls (Group)

Occurrences

Minimum: 0

Maximum: unbounded

Example

The following example is an XML fragment that defines a group of gallery button controls that are used for applying a formatting style.

<Group
    Id="grpStyles"
    Description=""
    Title="Group Styles"
    Template="tmpStyles">
    <Controls>
        <GalleryButton
            Id="buttonStaticStyle1"
            Command="ApplyStyle"
            QueryCommand="QueryStyle"
            InnerHTML="&lt;DIV class=&quot;PreviewStyleContainer&quot;&gt;&lt;P class=&quot;PreviewStaticStyle1&quot; id=&quot;labelPreviewContent0&quot;&gt;&lt;/P&gt;&lt;P class=&quot;PreviewStyleLabel&quot; id=&quot;labelPreviewStyle0&quot;&gt;&lt;/P&gt;&lt;/DIV&gt;"
            ElementDimensions="Size64by48"
            LabelText="Heading1"
            Alt="Heading1"
            TemplateAlias="preview1"/>
        <GalleryButton
            Id="buttonStaticStyle2"
            Command="ApplyStyle"
            QueryCommand="QueryStyle"
            InnerHTML="&lt;DIV class=&quot;PreviewStyleContainer&quot;&gt;&lt;P class=&quot;PreviewStaticStyle2&quot; id=&quot;labelPreviewContent1&quot;&gt;&lt;/P&gt;&lt;P class=&quot;PreviewStyleLabel&quot; id=&quot;labelPreviewStyle1&quot;&gt;&lt;/P&gt;&lt;/DIV&gt;"
            ElementDimensions="Size64by48"
            LabelText="Heading2"
            Alt="Heading2"
            TemplateAlias="preview2"/>
        <GalleryButton
            Id="buttonStaticStyle3"
            QueryCommand="QueryStyle"
            Command="ApplyStyle"
            InnerHTML="&lt;DIV class=&quot;PreviewStyleContainer&quot;&gt;&lt;P class=&quot;PreviewStaticStyle3&quot; id=&quot;labelPreviewContent2&quot;&gt;&lt;/P&gt;&lt;P class=&quot;PreviewStyleLabel&quot; id=&quot;labelPreviewStyle2&quot;&gt;&lt;/P&gt;&lt;/DIV&gt;"
            ElementDimensions="Size64by48"
            LabelText="Heading3"
            Alt="Heading3"
            TemplateAlias="preview3"/>
        <GalleryButton
            Id="buttonStaticStyle4"
            Command="ApplyStyle"
            QueryCommand="QueryStyle"
            InnerHTML="&lt;DIV class=&quot;PreviewStyleContainer&quot;&gt;&lt;P class=&quot;PreviewStaticStyle4&quot; id=&quot;labelPreviewContent3&quot;&gt;&lt;/P&gt;&lt;P class=&quot;PreviewStyleLabel&quot; id=&quot;labelPreviewStyle3&quot;&gt;&lt;/P&gt;&lt;/DIV&gt;"
            ElementDimensions="Size64by48"
            LabelText="Quote"
            Alt="Quote"
            TemplateAlias="preview4"/>
        <GalleryButton
            Id="buttonStaticStyle5"
            Command="ApplyStyle"
            QueryCommand="QueryStyle"
            InnerHTML="&lt;DIV class=&quot;PreviewStyleContainer&quot;&gt;&lt;P class=&quot;PreviewStaticStyle5&quot; id=&quot;labelPreviewContent4&quot;&gt;&lt;/P&gt;&lt;P class=&quot;PreviewStyleLabel&quot; id=&quot;labelPreviewStyle4&quot;&gt;&lt;/P&gt;&lt;/DIV&gt;"
            ElementDimensions="Size64by48"
            LabelText="Citation"
            Alt="Citation"
            TemplateAlias="preview5"/>
        <FlyoutAnchor
            Alt="STR@L_MenuMoreStyles"
            Id="fsfaMoreStyles"
            Command="MenuOpenEditOnly"
            MenuAlt="STR@L_MenuMoreStyles"
            LabelText="STR@L_MenuMoreStyles"
            Image32by32="IMGMAP@one@UxGalWordQuickFormatsHH"
            TemplateAlias="morestyles"
            PopulateDynamically="true"
            PopulateOnlyOnce="false"
            PopulateQueryCommand="PopulateMenuMoreStyles"
            CommandMenuClose="MenuClose"
            CacheMenuVersions="false">
        </FlyoutAnchor>
    </Controls>
</Group>