40 lines
2.0 KiB
XML
40 lines
2.0 KiB
XML
<Styles xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:anim="https://github.com/whistyun/AnimatedImage.Avalonia"
|
|
xmlns:local="clr-namespace:DispenserUI.Views.Controls">
|
|
|
|
<Style Selector="local|LoadingButton">
|
|
<Setter Property="Background" Value="LightGray" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Button Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
VerticalContentAlignment="Center"
|
|
HorizontalContentAlignment="Center">
|
|
<Grid
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch">
|
|
<Image Grid.Row="0" Name="PART_LoadingImage"
|
|
IsVisible="{Binding IsLoading, RelativeSource={RelativeSource TemplatedParent}}"
|
|
anim:ImageBehavior.AnimatedSource="avares://DispenserUI/Assets/loading.gif"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch" />
|
|
<TextBlock Grid.Row="0"
|
|
Text="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Grid>
|
|
</Button>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- Style to handle the loading pseudo-class -->
|
|
<Style Selector="local|LoadingButton:loading /template/ Image#PART_LoadingImage">
|
|
<Setter Property="Opacity" Value="1" />
|
|
</Style>
|
|
|
|
</Styles> |