- add button styles

master
Simon G 5 years ago
parent a6d845c451
commit a08eb10c25
  1. 45
      Mystify/Resources/Styles/ButtonStyles.axaml

@ -0,0 +1,45 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:Mystify.Resources.Themes">
<Design.PreviewWith>
<Border Padding="20">
<Button Height="100" Width="250" Content="Test"/>
</Border>
</Design.PreviewWith>
<Styles.Resources>
<SolidColorBrush x:Key="ButtonBackground" Color="{x:Static themes:DarkTheme.BUTTON_BACKGROUND}"/>
<SolidColorBrush x:Key="ButtonForeground" Color="{x:Static themes:DarkTheme.BUTTON_FOREGROUND}"/>
<SolidColorBrush x:Key="ButtonBorder" Color="{x:Static themes:DarkTheme.BUTTON_BORDER}"/>
<SolidColorBrush x:Key="ButtonMouseOverBackground" Color="{x:Static themes:DarkTheme.BUTTON_MOUSE_OVER_BACKGROUND}"/>
</Styles.Resources>
<Style Selector="Button">
<Setter Property="Background" Value="{StaticResource ButtonBackground}"/>
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}"/>
<Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
CornerRadius="5">
<ContentPresenter VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Background="Transparent"
Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="Button:pointerover">
<Setter Property="Background" Value="{StaticResource ButtonMouseOverBackground}"/>
</Style>
</Styles>
Loading…
Cancel
Save