Élément Button

Représente un contrôle Button .

Utilisation

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

Attributs

Attribut Type Obligatoire Description
ApplicationDefaults.IsChecked
Boolean
Non
Cet attribut est valide uniquement lorsque l’élément Button est un enfant de QuickAccessToolbar.ApplicationDefaults.
Limité à l’une des valeurs suivantes :

(true)
Par défaut.
(false)
ApplicationModes
xs:string
Non
Valide uniquement si MenuGroup est l’élément parent.

(xs:string)
Chaîne qui contient une liste séparée par des virgules d’entiers compris entre 0 et 31.
Les espaces blancs sont valides et ignorés.
Longueur maximale : 250 caractères.
CommandName
xs:positiveInteger ou xs:string
Non
Associe l’élément à une commande.

(xs:positiveInteger ou xs:string)
Chaîne, valeur entière comprise entre 2 et 59999, inclusive, ou valeur hexadécimale comprise entre 0x2 et 0xea5f, inclusive.
La valeur doit être unique dans le document XML du ruban.
Longueur maximale : 100 caractères.

Éléments enfants

Il n’y a pas d’éléments enfants.

Éléments parents

Élément
ControlGroup
DropDownButton
DropDownGallery
Groupe
MenuGroup
QuickAccessToolbar.ApplicationDefaults
SplitButton
SplitButton.ButtonItem
SplitButtonGallery

Notes

Optionnel.

Peut se produire au maximum une fois pour chaque élément SplitButton.ButtonItem .

Peut se produire une ou plusieurs fois pour chaque élément ControlGroup, DropDownButton, DropDownGallery, Group, MenuGroup, QuickAccessToolbar.ApplicationDefaults, SplitButton ou SplitButtonGallery .

Le bouton prend en charge les modes d’application lorsqu’il est hébergé dans la colonne de gauche du menu Application.

Exemples

L’exemple suivant illustre le balisage de base pour le Bouton.

Cette section de code affiche les déclarations Button Command, avec un groupe associé qui agit comme conteneur parent pour l’élément 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>

Cette section de code affiche les déclarations de contrôle Button .

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

Informations sur les éléments

  • Système minimum pris en charge : Windows 7
  • Peut être vide : Oui

Voir aussi

Contrôle de bouton

SetModes