Элемент Button

Представляет элемент управления Кнопка .

Использование

<Button
  ApplicationModes = "xs:string"
  CommandName = "xs:positiveInteger or xs:string"
  ApplicationDefaults.IsChecked = "Boolean"/>

Атрибуты

attribute Тип Обязательно Описание
ApplicationDefaults.IsChecked
Логическое
Нет
Этот атрибут действителен, только если элемент Button является дочерним элементом QuickAccessToolbar.ApplicationDefaults.
Ограничивается одним из следующих значений:

(true)
По умолчанию.
(false)
ApplicationModes
xs:string
Нет
Допустимо, только если MenuGroup является родительским элементом.

(xs:string)
Строка, содержащая разделенный запятыми список целых чисел от 0 до 31.
Пробелы допустимы и игнорируются.
Максимальная длина: 250 символов.
CommandName
xs:positiveInteger или xs:string
Нет
Связывает элемент с command.

(xs:positiveInteger или xs:string)
Строка, целочисленное значение от 2 до 59999 включительно или шестнадцатеричное значение в диапазоне от 0x2 до 0xea5f включительно.
Значение должно быть уникальным в XML-документе ленты.
Максимальная длина: 100 символов.

Дочерние элементы

Дочерние элементы отсутствуют.

Родительские элементы

Элемент
ControlGroup
DropDownButton
DropDownGallery
Группа
MenuGroup
QuickAccessToolbar.ApplicationDefaults
SplitButton
SplitButton.ButtonItem
SplitButtonGallery

Комментарии

Необязательный элемент.

Может возникать не более одного раза для каждого элемента SplitButton.ButtonItem .

Может встречаться один или несколько раз для каждого элемента ControlGroup, DropDownButton, DropDownGallery, Group, MenuGroup, QuickAccessToolbar.ApplicationDefaults, SplitButton или SplitButtonGallery .

Кнопка поддерживает режимы приложений , если она размещена в левом столбце меню приложения.

Примеры

В следующем примере показана базовая разметка для Button.

В этом разделе кода показаны объявления Button Command со связанной группой , которая выступает в качестве родительского контейнера для элемента Button .

<!-- Button -->
<Command Name="cmdButtonGroup"
         Symbol="cmdButtonGroup"
         Comment="Button Group"
         LabelTitle="ButtonGroup"/>
<Command Name="cmdButton1"
         Symbol="cmdButton1"
         Comment="Button1"
         LabelTitle="Button1"/>
<Command Name="cmdButton2"
         Symbol="cmdButton2"
         Comment="Button2"
         LabelTitle="Button2"/>
<Command Name="cmdButton3"
         Symbol="cmdButton3"
         Comment="Button3"
         LabelTitle="Button3"/>
<Command Name="cmdButtonGroup2"
         Symbol="cmdButtonGroup2"
         Comment="Button Group2"
         LabelTitle="ButtonGroup2"/>
<Command Name="cmdButtonG21"
         Symbol="cmdButtonG21"
         Comment="ButtonG21"
         LabelTitle="ButtonG21">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG22"
         Symbol="cmdButtonG22"
         Comment="ButtonG22"
         LabelTitle="ButtonG22">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG23"
         Symbol="cmdButtonG23"
         Comment="ButtonG23"
         LabelTitle="ButtonG23">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG24"
         Symbol="cmdButtonG24"
         Comment="ButtonG24"
         LabelTitle="ButtonG24">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>

В этом разделе кода показаны объявления элемента управления Button .

<Group CommandName="cmdButtonGroup"
       SizeDefinition="ThreeButtons">
  <Button CommandName="cmdButton1"></Button>
  <Button CommandName="cmdButton2"></Button>
  <Button CommandName="cmdButton3"></Button>
</Group>

Сведения об элементе

  • Минимальная поддерживаемая система: Windows 7
  • Может быть пустым: Да

См. также раздел

Элемент управления "Кнопка"

SetModes