Plane.FormationCreator/Plane.FormationCreator/StylesOld/ProgressButton.xaml
2017-02-27 02:06:48 +08:00

67 lines
3.9 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:ec="clr-namespace:Plane.Windows.Controls;assembly=Plane.Windows">
<Style TargetType="ec:ProgressButton"
BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding"
Value="20,0" />
<Setter Property="IsEnabled"
Value="{Binding IsProcessing, RelativeSource={RelativeSource Self}, Converter={StaticResource InverseBooleanConverter}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ec:ProgressButton">
<Border SnapsToDevicePixels="True"
BorderThickness="1"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="0,5"
ContentTemplate="{TemplateBinding ContentTemplate}"
RecognizesAccessKey="True" />
<c:ProgressRing Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="5,0,0,0"
IsActive="True"
Width="8"
Height="8"
Foreground="{StaticResource HighlightBrush}"
Visibility="{TemplateBinding IsProcessing, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="BorderBrush"
Value="{StaticResource BorderBrushHighlighted}" />
<Setter Property="Background"
Value="{StaticResource BackgroundHighlighted}" />
</Trigger>
<Trigger Property="IsPressed"
Value="True">
<Setter Property="Background"
Value="{StaticResource BackgroundSelected}" />
<Setter Property="BorderBrush"
Value="{StaticResource BorderBrushSelected}" />
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>