Windows-powershell / PowerShell-master /src /Microsoft.Management.UI.Internal /ShowCommand /Controls /ImageButton /ImageButtonCommon.xaml
| <!--================================================================= | |
| // Copyright (c) Microsoft Corporation. | |
| // Licensed under the MIT License. | |
| ==================================================================--> | |
| <ResourceDictionary | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2006" | |
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
| mc:Ignorable="d" | |
| xmlns:controls="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" | |
| xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"> | |
| <!-- ImageButtonBase Start --> | |
| <controls:ImageButtonToolTipConverter x:Key="imageButtonToolTipConverter"/> | |
| <LinearGradientBrush x:Key="ImageButtonPressedBrush" StartPoint="0,0" EndPoint="0,1"> | |
| <GradientBrush.GradientStops> | |
| <GradientStopCollection> | |
| <GradientStop Color="#BBB" Offset="0.0"/> | |
| <GradientStop Color="#EEE" Offset="0.1"/> | |
| <GradientStop Color="#EEE" Offset="0.9"/> | |
| <GradientStop Color="#FFF" Offset="1.0"/> | |
| </GradientStopCollection> | |
| </GradientBrush.GradientStops> | |
| </LinearGradientBrush> | |
| <SolidColorBrush x:Key="ImageButtonSelectedBackgroundBrush" Color="#DDD" /> | |
| <LinearGradientBrush x:Key="ImageButtonPressedBorderBrush" StartPoint="0,0" EndPoint="0,1"> | |
| <GradientBrush.GradientStops> | |
| <GradientStopCollection> | |
| <GradientStop Color="#444" Offset="0.0"/> | |
| <GradientStop Color="#888" Offset="1.0"/> | |
| </GradientStopCollection> | |
| </GradientBrush.GradientStops> | |
| </LinearGradientBrush> | |
| <SolidColorBrush x:Key="ImageButtonSolidBorderBrush" Color="#bbbbbb" /> | |
| <Style x:Key="imageButtonStyle" TargetType="{x:Type ButtonBase}"> | |
| <Setter Property="Tag" Value="{DynamicResource {x:Static SystemParameters.HighContrastKey}}" /> | |
| <Style.Triggers> | |
| <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Tag}" Value="False"> | |
| <Setter Property="Template"> | |
| <Setter.Value> | |
| <ControlTemplate TargetType="{x:Type ButtonBase}"> | |
| <Grid> | |
| <Border Padding="3,2,3,2" x:Name="Border" BorderBrush="Transparent" BorderThickness="1"> | |
| <Grid> | |
| <Image x:Name="EnabledImage" Margin="0,0,0,0" Stretch="None" Source="{Binding Path=EnabledImageSource, RelativeSource={RelativeSource AncestorType={x:Type controls:ImageButtonBase}}}"></Image> | |
| <Image x:Name="DisabledImage" Margin="0,0,0,0" Stretch="None" Source="{Binding Path=DisabledImageSource, RelativeSource={RelativeSource AncestorType={x:Type controls:ImageButtonBase}}}"></Image> | |
| </Grid> | |
| </Border> | |
| </Grid> | |
| <ControlTemplate.Triggers> | |
| <Trigger Property="IsEnabled" Value="True"> | |
| <Setter Property="Visibility" Value="Visible" TargetName="EnabledImage"></Setter> | |
| <Setter Property="Visibility" Value="Collapsed" TargetName="DisabledImage"></Setter> | |
| </Trigger> | |
| <Trigger Property="IsEnabled" Value="False"> | |
| <Setter Property="Visibility" Value="Collapsed" TargetName="EnabledImage"></Setter> | |
| <Setter Property="Visibility" Value="Visible" TargetName="DisabledImage"></Setter> | |
| </Trigger> | |
| <Trigger Property="IsKeyboardFocused" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{StaticResource ImageButtonSelectedBackgroundBrush}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ImageButtonSolidBorderBrush}" /> | |
| </Trigger> | |
| <Trigger Property="IsMouseOver" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{StaticResource ImageButtonSelectedBackgroundBrush}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ImageButtonSolidBorderBrush}" /> | |
| </Trigger> | |
| <Trigger Property="Button.IsPressed" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{StaticResource ImageButtonPressedBrush}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ImageButtonPressedBorderBrush}" /> | |
| </Trigger> | |
| <Trigger Property="ToggleButton.IsChecked" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{StaticResource ImageButtonPressedBrush}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ImageButtonPressedBorderBrush}" /> | |
| </Trigger> | |
| </ControlTemplate.Triggers> | |
| </ControlTemplate> | |
| </Setter.Value> | |
| </Setter> | |
| </DataTrigger> | |
| <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Tag}" Value="True"> | |
| <Setter Property="Template"> | |
| <Setter.Value> | |
| <ControlTemplate TargetType="{x:Type ButtonBase}"> | |
| <Grid> | |
| <Border Padding="0" x:Name="Border" BorderBrush="Transparent" BorderThickness="1"> | |
| <Grid> | |
| <Image x:Name="EnabledImage" Margin="5" Stretch="None" Source="{Binding Path=EnabledImageSource, RelativeSource={RelativeSource AncestorType={x:Type controls:ImageButtonBase}}}"></Image> | |
| <Image x:Name="DisabledImage" Margin="5" Stretch="None" Source="{Binding Path=DisabledImageSource, RelativeSource={RelativeSource AncestorType={x:Type controls:ImageButtonBase}}}"></Image> | |
| </Grid> | |
| </Border> | |
| </Grid> | |
| <ControlTemplate.Triggers> | |
| <Trigger Property="IsEnabled" Value="True"> | |
| <Setter Property="Visibility" Value="Visible" TargetName="EnabledImage"></Setter> | |
| <Setter Property="Visibility" Value="Collapsed" TargetName="DisabledImage"></Setter> | |
| </Trigger> | |
| <Trigger Property="IsEnabled" Value="False"> | |
| <Setter Property="Visibility" Value="Collapsed" TargetName="EnabledImage"></Setter> | |
| <Setter Property="Visibility" Value="Visible" TargetName="DisabledImage"></Setter> | |
| </Trigger> | |
| <Trigger Property="IsKeyboardFocused" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |
| </Trigger> | |
| <Trigger Property="IsMouseOver" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |
| </Trigger> | |
| <Trigger Property="Button.IsPressed" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |
| </Trigger> | |
| <Trigger Property="ToggleButton.IsChecked" Value="true"> | |
| <Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" /> | |
| <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |
| </Trigger> | |
| </ControlTemplate.Triggers> | |
| </ControlTemplate> | |
| </Setter.Value> | |
| </Setter> | |
| </DataTrigger> | |
| </Style.Triggers> | |
| </Style> | |
| <!-- ImageButtonBase End --> | |
| </ResourceDictionary> | |