适用于: SharePoint 2016 |SharePoint Foundation 2013 |SharePoint Online |SharePoint Server 2013
定义复选框控件。
<CheckBox
     Alt="Text"
     Command="Text"
     Id="Text"
     LabelText="Text"
     MenuItemId="Text"
     QueryCommand="Text"
     Sequence="Integer"
     TemplateAlias="Text"
     ToolTipImage32by32="Url"
     ToolTipImage32by32Class="CSS Class Selector"
     ToolTipImage32by32Left="Negative Integer"
     ToolTipImage32by32Top="Negative Integer"
     ToolTipTitle="Text"
     ToolTipDescription="Text"
     ToolTipHelpKeyWord="Text"
     ToolTipShortcutKey="Text"
/>
元素和属性
下面各部分介绍了属性、子元素和父元素。
Attributes
| 属性 | 说明 | 
|---|---|
| Alt | 可选。 用于复选框的可选文本。 | 
| 命令 | 可选。 选择控件时要执行的命令的名称。 如果此控件在 CommandUIDefinition 元素中,则此控件的 Command 属性值应该与相应 CommandUIHandler 元素的 Command 属性值相同。 | 
| Id | 必填。 标识控件。 值可以是一个表示 GUID 或唯一术语的字符串,例如“Ribbon.Library.Share.NewRibbonCheckBox”。 | 
| LabelText | 可选。 用于标注控件的文本。 | 
| MenuItemId | 可选。 用于标识按钮所在的菜单项的字符串。 | 
| QueryCommand | 可选。 轮询状态信息时要执行的命令的名称。 | 
| Sequence | 可选。 一个指定同级 XML 节点之间的放置顺序的整数。 | 
| TemplateAlias | 可选。 一个匹配 ControlRef 元素、OverflowArea 元素或 GroupTemplate 元素中的 OverflowSection 元素的 TemplateAlias 属性值的字符串。 在对某个组应用模板时,可使用 TemplateAlias 属性调整该组中控件的大小和位置。 | 
| ToolTipImage32by32 | 可选。 文件的相对于服务器的 URL,该文件包含要用于工具提示的 32 x 32 像素图像,例如“/_layouts/1033/images/formatmap32x32.png”。 | 
| ToolTipImage32by32Class | 可选。 应用于工具提示图像的 CSS 类选择器的名称。 | 
| ToolTipImage32by32Left | 可选。 一个负整数,表示图像左边缘的偏移。 当 ToolTipImage32by32 属性指向一个图像文件(其中包含许多图标的图像)时,使用此属性。 ToolTipImage32by32Left 属性的值用于设置级联样式 HTML img 标记的 CSS left 属性。 | 
| ToolTipImage32by32Top | 可选。 一个负整数,表示图像上边缘的偏移。 当 ToolTipImage32by32 属性指向一个图像文件(其中包含许多图标的图像)时,使用此属性。 ToolTipImage32by32Top 属性的值用于设置级联样式 HTML img 标记的 CSS top 属性。 | 
| ToolTipTitle | 可选。 显示为工具提示标题的文本。 | 
| ToolTipDescription | 可选。 显示在工具提示正文中的文本。 | 
| ToolTipHelpKeyWord | 可选。 上下文相关帮助使用的关键字。 | 
| ToolTipShortcutKey | 可选。 在工具提示中针对快捷键显示的文本。 例如,如果控件的快捷键为 Alt+J,则此属性的值为“Alt+J”。 工具提示将在工具提示标题后面的括号中显示快捷键的文本:“ (Alt+J) ”。 | 
子元素
无
父元素
- CommandUIDefinition
- Controls (Group)
出现次数
- 最小值:0
- 最大值:无限制
示例
以下示例是一个 XML 片段,用于定义包含 CheckBox 元素的一组控件。
<Group
  Id="Ribbon.Image.Image.Size"
  Sequence="50"
  Command="ImageSizeGroup"
  Description=""
  Title="$Resources:core,GrpSize;"
  Image32by32Popup="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32PopupTop="-128" Image32by32PopupLeft="0"
  Template="Ribbon.Templates.Flexible2"
>
  <Controls Id="Ribbon.Image.Image.Size.Controls">
    <Label
      Id="Ribbon.Image.Image.Size.HorizontalSizeLabel"
      LabelText="$Resources:core,LabelHorizSize;"
      Command="ImageHorizontalLabel"
      ForId="Ribbon.Image.Image.Size.HorizontalSize"
      Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-80" Image16by16Left="-16"
      TemplateAlias="o1"
      Sequence="10"
    />
    <Spinner
       Id="Ribbon.Image.Image.Size.HorizontalSize"
       DefaultUnit="pixel"
       DefaultValue="10"
       AltUpArrow="$Resources:core,cui_spnUpAlt;"
       AltDownArrow="$Resources:core,cui_spnDownAlt;"
       AccelerationInterval="125"
       MultiplierInterval="2000"
       ImeEnabled="false"
       Command="ImageWidth"
       QueryCommand="QueryImageWidth"
       ToolTipTitle="$Resources:core,LabelHorizSize;"
       ToolTipDescription="$Resources:core,cui_stt_ButSizeMenuHorizontalSizeTooltip;"
       TemplateAlias="o2"
      Sequence="20"
    >
      <Unit
          Name="pixel"
          MinimumValue="1"
          MaximumValue="2000"
          DecimalDigits="0"
          Interval="5"
        >
        <UnitAbbreviation Value="px" />
      </Unit>
      <Unit
          Name="percent"
          MinimumValue="1"
          MaximumValue="100"
          DecimalDigits="0"
          Interval="1"
        >
        <UnitAbbreviation Value="%" />
      </Unit>
    </Spinner>
    <Label
      Id="Ribbon.Image.Image.Size.VertSizeLabel"
      LabelText="$Resources:core,LabelVertSize;"
      Command="ImageVerticalLabel"
      ForId="Ribbon.Image.Image.Size.VerticalSize"
      Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-208" Image16by16Left="-224"
      TemplateAlias="o1"
      Sequence="30"
    />
    <Spinner
      Id="Ribbon.Image.Image.Size.VerticalSize"
      DefaultUnit="pixel"
      DefaultValue="10"
      AltUpArrow="$Resources:core,cui_spnUpAlt;"
      AltDownArrow="$Resources:core,cui_spnDownAlt;"
      AccelerationInterval="125"
      MultiplierInterval="2000"
      Command="ImageHeight"
      ImeEnabled="false"
      QueryCommand="QueryImageHeight"
      ToolTipTitle="$Resources:core,LabelVertSize;"
      ToolTipDescription="$Resources:core,cui_stt_ButSizeMenuVerticalSizeTooltip;"
      TemplateAlias="o2"
      Sequence="40"
    >
      <Unit
          Name="pixel"
          MinimumValue="1"
          MaximumValue="2000"
          DecimalDigits="0"
          Interval="5"
        >
        <UnitAbbreviation Value="px" />
      </Unit>
      <Unit
          Name="percent"
          MinimumValue="1"
          MaximumValue="100"
          DecimalDigits="0"
          Interval="1"
        >
        <UnitAbbreviation Value="%" />
      </Unit>
    </Spinner>
    <CheckBox
      Id="Ribbon.Image.Image.Size.LockAspect"
      Command="ImageLockRatio"
      QueryCommand="QueryImageLockRatio"
      LabelText="$Resources:core,LabelLockAspect;"
      Alt="$Resources:core,ButLockAspectAlt;"
      TemplateAlias="o2"
      Sequence="50"
    />
  </Controls>
</Group>