Partager via


Configurer les barres d’outils de votre application

Vous pouvez configurer les barres d’outils dans Unified Service Desk pour créer ou gérer les boutons d’une barre d’outils existante, ou pour créer de nouvelles barres d’outils. Pour une vue d’ensemble des barres d’outils, voir Barres d’outils dans Unified Service Desk.

Créer une barre d’outils

Avant de créer une barre d’outils, assurez-vous qu’un contrôle hébergé Conteneur de barre d’outils a déjà été configuré. Pour plus d’informations, voir Conteneur de barre d’outils (contrôle hébergé).

  1. Connectez-vous à l’administrateur de Unified Service Desk.

  2. Sélectionnez Barres d’outils sous Paramètres de base.

  3. Sélectionnez + Nouveau.

  4. Dans la page Nouvelle barre d’outils :

    1. Tapez un nom pour la nouvelle barre d’outils.

    2. Tapez le titre de la barre d’outils, qui s’affiche dans l’angle gauche de la barre d’outils.

    3. Cliquez sur Enregistrer pour activer la zone Boutons.

  5. Sous la zone Boutons, cliquez sur + Ajouter le bouton de nouvelle barre d’outils pour créer un bouton à placer dans la barre d’outils.

  6. Dans la page Nouveau bouton de barre d’outils :

    1. Spécifiez le nom du bouton.

    2. Spécifiez le nom du fichier image du bouton de la barre d’outils.

    3. Dans le champ ButtonText, tapez l’étiquette du bouton.

    4. Pour contrôler l’ordre d’affichage des boutons de la barre d’outils, de la gauche vers la droite, spécifiez un nombre entier dans le champ Ordre. Les boutons sont disposés de gauche à droite par ordre croissant.

    5. Cliquez sur Enregistrer pour activer la zone Actions.

  7. Sous la zone Actions, cliquez sur Ajouter l’appel à l’action existant pour ajouter un appel à l’action pour le bouton. Le volet Rechercher des incidents s’affiche.

  8. Dans la zone de recherche sous la zone Actions, tapez le nom de l’appel à l’action que vous souhaitez associé au bouton. Sélectionnez l’appel à l’action à partir de la liste, et cliquez sur Ajouter.

    Pour associer le bouton à un nouvel appel à l’action, cliquez sur Nouveau, puis créez un appel à l’action et ajoutez-le à l’action UII. Pour plus d’informations, voir Créer un appel à l’action pour une action UII.

  9. Pour ajouter un bouton dans la barre d’outils, suivez les étapes 5 à 8.

  10. Après l’ajout de boutons et d’appels à l’action à une barre d’outils, associez la barre d’outils à un conteneur de barre d’outils. Cette opération permet de spécifier l’emplacement de la nouvelle barre d’outils sur le bureau de Unified Service Desk. Ouvrez la définition de la barre d’outils, cliquez sur l’onglet Association, puis sélectionnez Contrôles hébergés.

  11. Sur la page suivante, cliquez sur Ajouter le contrôle hébergé existant. Le volet Rechercher des incidents s’affiche.

  12. Dans la zone de recherche, tapez le nom du contrôle hébergé Conteneur de barre d’outils, cliquez sur Rechercher, puis sélectionnez le contrôle hébergé dans la liste, et sélectionnez Ajouter.

  13. Sélectionnez Enregistrer.

  14. Sous la zone Styles, dans la zone de texte Styles personnalisés, entrez la chaîne XAML pour personnaliser la barre d’outils et les boutons. Pour plus d’informations : Styles dans barre d’outils

  15. Cliquez sur Enregistrer.

Ajouter/supprimer un bouton d’une barre d’outils existante

  1. Connectez-vous à l’administrateur de Unified Service Desk.

  2. Sélectionnez Barres d’outils sous Paramètres de base.

  3. Dans la page des barres d’outils, cliquez sur le nom de la barre d’outils à modifier.

  4. La page suivante affiche la définition de la barre d’outils.

    1. Ajouter d’autres boutons en utilisant la zone Boutons. Pour plus d’informations, voir les étapes 6 à 10 de la section précédente.

    2. Modifier un bouton existant en sélectionnant le nom du bouton sous les Boutons. Cela ouvre la page de définition du bouton où vous pouvez modifier les informations sur ce dernier, telles que le nom, le texte du bouton (étiquette), l’ordre et l’appel à l’action.

    3. Sélectionnez Enregistrer pour enregistrer les changements.

Styles dans la barre d’outils

Vous pouvez désormais personnaliser la barre d’outils dans Unified Service Desk à l’aide du champ de styles personnalisés dans la fenêtre de configuration de la barre d’outils. Le champ Styles personnalisés prend en charge le langage XAML (Extensible Application Markup Language) qui définit ResourceDictionary des ressources Style et Brush.

Les ressources du dictionnaire font référence à d’autres ressources disponibles sur l’application cliente Unified Service Desk. Le chargement et l’analyse la chaîne XAML est effectué au moment de l’exécution pour créer ResourceDictionary et fusionner les ressources du contrôle de la barre d’outils avec le ResourceDictionary. En outre, le ResourceDictionary peut avoir des styles pour les types de bouton au sein d’une barre d’outils. Grâce aux styles, vous pouvez personnaliser les barres d’outils et les boutons.

Exemple 1 : L’exemple de XAML qui définit le ResourceDictionary des ressources Style et Brush montre la personnalisation de la barre d’outils À propos.

Note

Vous pouvez trouver ces exemples de styles XAM dans l’exemple de package Unified Service Desk - Unified Interface.

<ResourceDictionary xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:usd="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" 
xmlns:controlStyles="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls.Styles;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" 
xmlns:usdPanelLayouts="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.PanelLayouts;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics" 
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" 
xmlns:control="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics"> 

  <Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}"> 
        <Setter Property="Margin" Value="0,0,0,0"/> 
        <Setter Property="CornerRadius" Value="3,3,3,3"/> 
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/> 
        <Style.Triggers> 
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> 
                <Setter Property="CornerRadius" Value="0,0,0,0"/> 
            </DataTrigger> 
        </Style.Triggers> 
    </Style> 

<Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}"> 
        <Setter Property="Template"> 
            <Setter.Value> 
                <ControlTemplate TargetType="{x:Type Thumb}"> 
                    <Border Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> 
                        <Rectangle> 
                            <Rectangle.Fill> 
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,4,4" Viewport="0,0,4,4" ViewportUnits="Absolute" ViewboxUnits="Absolute"> 
                                    <DrawingBrush.Drawing> 
                                        <DrawingGroup> 
                                            <GeometryDrawing Brush="White" Geometry="M 1 1 L 1 3 L 3 3 L 3 1 z"/> 
                                            <GeometryDrawing Brush="{DynamicResource ToolBarGripper}" Geometry="M 0 0 L 0 2 L 2 2 L 2 0 z"/> 
                                        </DrawingGroup> 
                                    </DrawingBrush.Drawing> 
                                </DrawingBrush> 
                            </Rectangle.Fill> 
                        </Rectangle> 
                    </Border> 
                    <ControlTemplate.Triggers> 
                        <Trigger Property="IsMouseOver" Value="true"> 
                            <Setter Property="Cursor" Value="SizeAll"/> 
                        </Trigger> 
                    </ControlTemplate.Triggers> 
                </ControlTemplate> 
            </Setter.Value> 
        </Setter> 
    </Style> 

<Style x:Key="ToolBarHorizontalOverflowButtonStyle" TargetType="{x:Type ToggleButton}"> 
<Setter Property="Background" Value="Transparent"/> 
<Setter Property="MinHeight" Value="0"/> 
<Setter Property="MinWidth" Value="0"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/> 
<Setter Property="Template"> 
<Setter.Value> 
<ControlTemplate TargetType="{x:Type ToggleButton}"> 
<Border x:Name="Bd" Background="Transparent" CornerRadius="0" SnapsToDevicePixels="true"> 
<Image Source="{DynamicResource ImageMoreToolBarButtons}" Margin="7,5,7,5" Width="16" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Right" 
  AutomationProperties.Name="More Menu"></Image> 
</Border> 
<ControlTemplate.Triggers> 
<Trigger Property="IsMouseOver" Value="true"> 
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/> 
</Trigger> 
<Trigger Property="IsKeyboardFocused" Value="true"> 
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/> 
</Trigger> 
<Trigger Property="IsEnabled" Value="false"> 
<Setter Property="Foreground" Value="{DynamicResource ToolBarGripper}"/> 
</Trigger> 
</ControlTemplate.Triggers> 
</ControlTemplate> 
</Setter.Value> 
</Setter> 
<Style.Triggers> 
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> 
<Setter Property="Background" Value="Transparent"/> 
</DataTrigger> 
</Style.Triggers> 
</Style> 

<Style x:Key="MainToolBarFocusVisual"> 
    <Setter Property="Control.Template"> 
      <Setter.Value> 
        <ControlTemplate> 
          <Rectangle SnapsToDevicePixels="true" Stroke="White" 
                  StrokeDashArray="1 2" StrokeThickness="1"/> 
        </ControlTemplate> 
      </Setter.Value> 
    </Setter> 
  </Style> 


<Style x:Key="ToolBarVerticalOverflowButtonStyle" TargetType="{x:Type ToggleButton}"> 
<Setter Property="Background" Value="{DynamicResource NormalBrush}"/> 
<Setter Property="MinHeight" Value="0"/> 
<Setter Property="MinWidth" Value="0"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/> 
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/> 
<Setter Property="Template"> 
<Setter.Value> 
<ControlTemplate TargetType="{x:Type ToggleButton}"> 
<Border x:Name="Bd" Background="Transparent" CornerRadius="0" SnapsToDevicePixels="true"> 
<Image Source="{DynamicResource ImageMoreToolBarButtons}" Margin="7,5,7,5" Width="16" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Right" 
  AutomationProperties.Name="More Menu"></Image> 
</Border> 
<ControlTemplate.Triggers> 
<Trigger Property="IsMouseOver" Value="true"> 
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/> 
</Trigger> 
<Trigger Property="IsKeyboardFocused" Value="true"> 
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/> 
</Trigger> 
<Trigger Property="IsEnabled" Value="false"> 
<Setter Property="Foreground" Value="{DynamicResource ToolBarGripper}"/> 
</Trigger> 
</ControlTemplate.Triggers> 
</ControlTemplate> 
</Setter.Value> 
</Setter> 
<Style.Triggers> 
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> 
<Setter Property="Background" Value="Transparent"/> 
</DataTrigger> 
</Style.Triggers> 
</Style> 

<Style TargetType="{x:Type ToolBar}"> 
<Setter Property="Background" Value="Transparent"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/> 
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/> 
<Setter Property="Template"> 
<Setter.Value> 
<ControlTemplate TargetType="{x:Type ToolBar}"> 
<Grid x:Name="Grid" Margin="0,0,0,0" SnapsToDevicePixels="true" Height="42"> 
<Grid x:Name="OverflowGrid" HorizontalAlignment="Right" Margin="0,0,-11,0"> 
<ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"  
  IsEnabled="{TemplateBinding HasOverflowItems}" Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}" Visibility="Collapsed" 
  Margin="0,0,0,5"> 
</ToggleButton> 
<Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="True" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false"> 
<themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent"> 
<Border x:Name="ToolBarSubMenuBorder" BorderBrush="{DynamicResource ToolBarMenuBorder}" BorderThickness="1" Background="{DynamicResource ToolBarSubMenuBackground}" RenderOptions.ClearTypeHint="Enabled"> 
<ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Continue" FocusVisualStyle="{x:Null}" Focusable="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/> 
</Border> 
</themes:SystemDropShadowChrome> 
</Popup> 
</Grid> 
<Border x:Name="MainPanelBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" Style="{StaticResource ToolBarMainPanelBorderStyle}"> 
<DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local"> 
<Thumb x:Name="ToolBarThumb" Margin="-3,-1,0,0" Padding="6,5,1,6" Style="{StaticResource ToolBarThumbStyle}"/> 
<ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0,4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/> 
<ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> 
</DockPanel> 
</Border> 
</Grid> 
<ControlTemplate.Triggers> 
<Trigger Property="HasOverflowItems" Value="true"> 
<Setter Property="Visibility" TargetName="OverflowButton" Value="Visible"/> 
</Trigger> 
<Trigger Property="IsOverflowOpen" Value="true"> 
<Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false"/> 
</Trigger> 
<Trigger Property="Header" Value="{x:Null}"> 
<Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/> 
</Trigger> 
<Trigger Property="ToolBarTray.IsLocked" Value="true"> 
<Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/> 
</Trigger> 
<Trigger Property="HasDropShadow" SourceName="OverflowPopup" Value="true"> 
<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/> 
<Setter Property="SnapsToDevicePixels" TargetName="Shdw" Value="true"/> 
<Setter Property="Color" TargetName="Shdw" Value="#71000000"/> 
</Trigger> 
<Trigger Property="Orientation" Value="Vertical"> 
<Setter Property="Margin" TargetName="Grid" Value="1,3,1,1"/> 
<Setter Property="Style" TargetName="OverflowButton" Value="{StaticResource ToolBarVerticalOverflowButtonStyle}"/> 
<Setter Property="Height" TargetName="ToolBarThumb" Value="10"/> 
<Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/> 
<Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/> 
<Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/> 
<Setter Property="Margin" TargetName="ToolBarHeader" Value="0,0,0,4"/> 
<Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="1,0,2,2"/> 
<Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/> 
<Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top"/> 
<Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch"/> 
<Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom"/> 
<Setter Property="Placement" TargetName="OverflowPopup" Value="Right"/> 
<Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,11"/> 
<Setter Property="Background" Value="Transparent"/> 
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/> 
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/> 
</Trigger> 
<Trigger Property="IsEnabled" Value="false"> 
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> 
</Trigger> 
</ControlTemplate.Triggers> 
</ControlTemplate> 
</Setter.Value> 
</Setter> 
<Style.Triggers> 
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> 
<Setter Property="Background" Value="Transparent"/> 
</DataTrigger> 
</Style.Triggers> 
</Style> 

<Style x:Key="ToolBarButtonBaseStyle"> 
<Setter Property="Control.BorderThickness" Value="0"/> 
<Setter Property="Control.Padding" Value="0"/> 
<Setter Property="Control.Background" Value="Transparent"/> 
<Setter Property="Control.BorderBrush" Value="Transparent"/> 
<Setter Property="Control.Foreground" Value="{DynamicResource ToolBarFontColor}"/> 
<Setter Property="Control.FontFamily" Value="Segoe UI"/> 
<Setter Property="Control.FontSize" Value="12"/> 
</Style> 
<Style x:Key="ToolbarButtonTemplate" TargetType="{x:Type control:ToolbarButton}" BasedOn="{StaticResource ToolBarButtonBaseStyle}"> 
        <Setter Property="HorizontalContentAlignment" Value="Center"/> 
        <Setter Property="VerticalContentAlignment" Value="Center"/> 
        <Setter Property="VerticalAlignment" Value="Center"/> 
        <Setter Property="FontFamily" Value="Segoe UI"/> 
        <Setter Property="FontSize" Value="14"/> 
        <Setter Property="FocusVisualStyle" Value="{DynamicResource MainToolBarFocusVisual}" /> 
        <Setter Property="Template"> 
            <Setter.Value> 
                <ControlTemplate TargetType="{x:Type control:ToolbarButton}"> 
                    <Border x:Name="Bd" Height="42"  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> 
                        <StackPanel x:Name="AboutToolBarButtonStackPanel"  Orientation="Horizontal" Margin="7,0,7,0"> 
                            <Image Margin="0,0,7,0" x:Name="Icon" VerticalAlignment="Center" MaxWidth="16" MaxHeight="16" Source="{TemplateBinding Image}"/> 
                            <ContentPresenter Margin="0,7,0,7"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
                        </StackPanel> 
                    </Border> 
                    <ControlTemplate.Triggers> 
                        <Trigger Property="Text" Value="{x:Null}"> 
                            <Setter TargetName="Icon" Property="Margin" Value="0,0,0,0"/> 
                            <Setter TargetName="AboutToolBarButtonStackPanel" Property="Margin" Value="13,0,13,0"/> 
                        </Trigger> 
                        <Trigger Property="Image" Value="{x:Null}"> 
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/> 
                        </Trigger> 
                        <Trigger Property="IsMouseOver" Value="true"> 
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonHover}"/> 
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/> 
                        </Trigger> 
                        <Trigger Property="IsKeyboardFocused" Value="true"> 
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonHover}"/> 
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/> 
                        </Trigger> 
                        <Trigger Property="IsEnabled" Value="false"> 
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> 
                        </Trigger> 
                    </ControlTemplate.Triggers> 
                </ControlTemplate> 
            </Setter.Value> 
        </Setter> 
    </Style> 
      <Style x:Key="ToolBarSplitButtonStyle" TargetType="{x:Type control:SplitButton}" BasedOn="{StaticResource ToolBarButtonBaseStyle}" > 
    <Setter Property="HorizontalAlignment" Value="Stretch"/> 
    <Setter Property="VerticalAlignment" Value="Stretch"/> 
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/> 
    <Setter Property="VerticalContentAlignment" Value="Center"/> 
    <Setter Property="Height" Value="42"/> 
      <Setter Property="FocusVisualStyle" Value="{DynamicResource MainToolBarFocusVisual}"/> 
    <Setter Property="Template"> 
      <Setter.Value> 
        <ControlTemplate TargetType="{x:Type control:SplitButton}"> 
          <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> 
            <StackPanel Orientation="Horizontal" Margin="0,0,0,0"> 
              <Button x:Name="PART_Button"  Margin="0,0,0,0" Style="{DynamicResource ButtonStyle}" AutomationProperties.Name="{Binding Path=(AutomationProperties.Name), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type control:SplitButton}}}" FocusVisualStyle="{DynamicResource MainToolBarFocusVisual}" > 
                <StackPanel Orientation="Horizontal"> 
                  <Image x:Name="Icon"  Margin="7,0,7,0" VerticalAlignment="Center" MaxWidth="16" MaxHeight="16" Source="{TemplateBinding Image}"/> 
                  <ContentPresenter x:Name="ToolBarSplitButtonContent" Margin="0,7,7,7" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
                </StackPanel> 
              </Button> 
              <Separator Style="{DynamicResource VerticalSeparatorStyle}" Height="1" Width="16" Background="{DynamicResource SeparatorBrush}" Margin="0,0,0,0"/> 
              <Border x:Name="SplitDropDown"> 
                <Path x:Name="DownArrow" Style="{DynamicResource DownArrowGeometryStyle}" Margin="4,4,4,0"/> 
              </Border> 
            </StackPanel> 
          </Border> 
          <ControlTemplate.Triggers> 
            <Trigger Property="Image" Value="{x:Null}"> 
              <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/> 
              <Setter TargetName="ToolBarSplitButtonContent" Property="Margin" Value="7,7,7,7"/> 
            </Trigger> 
            <Trigger Property="Text" Value="{x:Null}"> 
              <Setter TargetName="ToolBarSplitButtonContent" Property="Margin" Value="0,0,0,0"/> 
            </Trigger> 
            <Trigger SourceName="PART_Button" Property="IsMouseOver" Value="True"> 
              <Setter Property="Background" Value="Transparent" TargetName="SplitDropDown"/> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}" TargetName="PART_Button"/> 
            </Trigger> 
            <Trigger SourceName="PART_Button" Property="IsKeyboardFocused" Value="True"> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}" TargetName="PART_Button"/> 
            </Trigger> 
            <Trigger SourceName="SplitDropDown" Property="IsMouseOver" Value="True"> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}" TargetName="SplitDropDown"/> 
              <Setter Property="Background" Value="Transparent" TargetName="PART_Button"/> 
            </Trigger> 
            <Trigger Property="IsChecked" Value="True"> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/> 
            </Trigger> 
            <Trigger Property="IsKeyboardFocused" Value="True"> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/> 
            </Trigger> 
            <MultiTrigger> 
              <MultiTrigger.Conditions> 
                <Condition Property="IsMouseOver" Value="True"/> 
                <Condition Property="IsChecked" Value="True"/> 
              </MultiTrigger.Conditions> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/> 
            </MultiTrigger> 
            <MultiTrigger> 
              <MultiTrigger.Conditions> 
                <Condition Property="IsKeyboardFocused" Value="True"/> 
                <Condition Property="IsChecked" Value="True"/> 
              </MultiTrigger.Conditions> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/> 
            </MultiTrigger> 
            <Trigger Property="IsPressed" Value="True"> 
              <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/> 
            </Trigger> 
            <Trigger Property="IsEnabled" Value="False"> 
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> 
            </Trigger> 
          </ControlTemplate.Triggers> 
        </ControlTemplate> 
      </Setter.Value> 
    </Setter> 
  </Style> 
</ResourceDictionary> 

Exemple 2 : L’exemple de XAML qui définit le ResourceDictionary des ressources Style et Brush montre la personnalisation de la barre d’outils Principal.

Note

Vous pouvez trouver ces exemples de styles XAM dans l’exemple de package Unified Service Desk - Unified Interface.

<ResourceDictionary xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:usd="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics"
xmlns:controlStyles="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls.Styles;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics"
xmlns:usdPanelLayouts="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.PanelLayouts;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics"
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"
xmlns:control="clr-namespace:Microsoft.Crm.UnifiedServiceDesk.Dynamics.Controls;assembly=Microsoft.Crm.UnifiedServiceDesk.Dynamics">

  <Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="CornerRadius" Value="3,3,3,3"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="CornerRadius" Value="0,0,0,0"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

<Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                        <Rectangle>
                            <Rectangle.Fill>
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,4,4" Viewport="0,0,4,4" ViewportUnits="Absolute" ViewboxUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <GeometryDrawing Brush="White" Geometry="M 1 1 L 1 3 L 3 3 L 3 1 z"/>
                                            <GeometryDrawing Brush="{DynamicResource ToolBarGripper}" Geometry="M 0 0 L 0 2 L 2 2 L 2 0 z"/>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Cursor" Value="SizeAll"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

<Style x:Key="ToolBarHorizontalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Bd" Background="Transparent" CornerRadius="0" SnapsToDevicePixels="true">
                        <Image Source="{DynamicResource ImageMoreToolBarButtons}" Margin="7,5,7,5" Width="16" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Right"
                                  AutomationProperties.Name="More Menu"></Image>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/>
                            <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="Transparent"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="ToolBarVerticalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="Bd" Background="Transparent" CornerRadius="0" SnapsToDevicePixels="true">
                        <Image Source="{DynamicResource ImageMoreToolBarButtons}" Margin="7,5,7,5" Width="16" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Right"
                                  AutomationProperties.Name="More Menu"></Image>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource USDTabBackgroundBrush}"/>
                            <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="Transparent"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

<Style TargetType="{x:Type ToolBar}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
        <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolBar}">
                    <Grid x:Name="Grid" Margin="0,0,0,0" SnapsToDevicePixels="true" Height="42">
                        <Grid x:Name="OverflowGrid" HorizontalAlignment="Right" Margin="0,0,-11,0">
                            <ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                          IsEnabled="{TemplateBinding HasOverflowItems}" Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}" Visibility="Collapsed"
                                          Margin="0,0,0,5">
                            </ToggleButton>
                            <Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="True" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false">
                                <themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
                                    <Border x:Name="ToolBarSubMenuBorder" BorderBrush="{DynamicResource ToolBarMenuBorder}" BorderThickness="1" Background="{DynamicResource ToolBarSubMenuBackground}" RenderOptions.ClearTypeHint="Enabled">
                                        <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Continue" FocusVisualStyle="{x:Null}" Focusable="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/>
                                    </Border>
                                </themes:SystemDropShadowChrome>
                            </Popup>
                        </Grid>
                        <Border x:Name="MainPanelBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" Style="{StaticResource ToolBarMainPanelBorderStyle}">
                            <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
                                <Thumb x:Name="ToolBarThumb" Margin="-3,-1,0,0" Padding="6,5,1,6" Style="{StaticResource ToolBarThumbStyle}"/>
                                <ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0,4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                                <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </DockPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasOverflowItems" Value="true">
                            <Setter Property="Visibility" TargetName="OverflowButton" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsOverflowOpen" Value="true">
                            <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false"/>
                        </Trigger>
                        <Trigger Property="Header" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ToolBarTray.IsLocked" Value="true">
                            <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="HasDropShadow" SourceName="OverflowPopup" Value="true">
                            <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                            <Setter Property="SnapsToDevicePixels" TargetName="Shdw" Value="true"/>
                            <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="Margin" TargetName="Grid" Value="1,3,1,1"/>
                            <Setter Property="Style" TargetName="OverflowButton" Value="{StaticResource ToolBarVerticalOverflowButtonStyle}"/>
                            <Setter Property="Height" TargetName="ToolBarThumb" Value="10"/>
                            <Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/>
                            <Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/>
                            <Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/>
                            <Setter Property="Margin" TargetName="ToolBarHeader" Value="0,0,0,4"/>
                            <Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="1,0,2,2"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top"/>
                            <Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch"/>
                            <Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom"/>
                            <Setter Property="Placement" TargetName="OverflowPopup" Value="Right"/>
                            <Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,11"/>
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Continue"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="Background" Value="Transparent"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

<Style x:Key="ToolBarButtonBaseStyle">
        <Setter Property="Control.BorderThickness" Value="0"/>
        <Setter Property="Control.Padding" Value="0"/>
        <Setter Property="Control.Background" Value="Transparent"/>
        <Setter Property="Control.BorderBrush" Value="Transparent"/>
        <Setter Property="Control.Foreground" Value="{DynamicResource ToolBarFontColor}"/>
        <Setter Property="Control.FontFamily" Value="Segoe UI"/>
        <Setter Property="Control.FontSize" Value="12"/>
    </Style>

<Style x:Key="MainToolBarFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle SnapsToDevicePixels="true" Stroke="White"
                  StrokeDashArray="1 2" StrokeThickness="1"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

<Style x:Key="ToolbarButtonTemplate" TargetType="{x:Type control:ToolbarButton}" BasedOn="{StaticResource ToolBarButtonBaseStyle}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource MainToolBarFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type control:ToolbarButton}">
                    <Border x:Name="Bd" Height="42"  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <StackPanel x:Name="ToolBarButtonStackPanel"  Orientation="Horizontal" Margin="14,0,14,0">
                            <Image Margin="0,0,7,0" x:Name="Icon" VerticalAlignment="Center" MaxWidth="16" MaxHeight="16" Source="{TemplateBinding Image}"/>
                            <ContentPresenter x:Name="ToolBarButtonContentPresenter" Margin="0,7,0,7" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </StackPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Text" Value="{x:Null}">
                            <Setter TargetName="Icon" Property="Margin" Value="0,0,0,0"/>
                        </Trigger>
                        <Trigger Property="Image" Value="{x:Null}">
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonPressed}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
<Style x:Key="ToolBarDropDownButtonStyle" TargetType="{x:Type control:DropDownButton}" BasedOn="{StaticResource ToolBarButtonBaseStyle}">
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="FocusVisualStyle" Value="{DynamicResource MainToolBarFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type control:DropDownButton}">
                    <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <!--<Label>-->
                        <StackPanel Orientation="Horizontal" Margin="14,0,14,0">
                            <Image Margin="0,0,7,0" x:Name="Icon" VerticalAlignment="Center" Width="16" Height="16" Source="{TemplateBinding Image}"/>
                            <ContentPresenter Margin="{TemplateBinding Margin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <Path x:Name="DownArrow" Style="{DynamicResource DownArrowGeometryStyle}" Margin="7,4,0,0"/>
                        </StackPanel>
                        <!--</Label>-->
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Text" Value="{x:Null}">
                            <Setter TargetName="Icon" Property="Margin" Value="0,0,0,0"/>
                        </Trigger>
                        <Trigger Property="Image" Value="{x:Null}">
                            <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background" Value="White"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarButtonHover}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarTextFontHighlightColor}" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter Property="Background" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarTextFontHighlightColor}" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsChecked" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{DynamicResource ToolBarSplitButtonSelectedBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarTextFontHighlightColor}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarTextFontHighlightColor}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                                <Condition Property="IsChecked" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="White"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarButtonHover}" />
                        </MultiTrigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="White"/>
                            <Setter Property="Foreground" Value="{DynamicResource ToolBarButtonHover}"/>
                            <Setter TargetName="DownArrow" Property="Stroke" Value="{DynamicResource ToolBarButtonHover}"/>

                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

Voir aussi

Barres d’outils dans Unified Service Desk

Vue d’ensemble de configuration de l’application de l’agent