define button styles globally

This commit is contained in:
2026-02-23 23:52:10 +03:00
parent 50228e98d9
commit 2045f72fca
4 changed files with 45 additions and 24 deletions

View File

@@ -10,6 +10,6 @@
</Application.DataTemplates>
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://KeyKeeper/Styles/AppTheme.axaml"/>
</Application.Styles>
</Application>

View File

@@ -0,0 +1,38 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border Background="White" Padding="60">
<Button Classes="" Content="contentъ"/>
</Border>
</Design.PreviewWith>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentTheme.xaml"/>
<Style Selector="Button:not(.dummy) /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#cccccc" />
<Setter Property="Foreground" Value="#000000" />
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#aaaaaa" />
<Setter Property="Foreground" Value="#000000" />
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#444444" />
<Setter Property="Foreground" Value="#ffffff" />
</Style>
<Style Selector="Button.accentSidebarButton /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#00000000" />
<Setter Property="Foreground" Value="white" />
</Style>
<Style Selector="Button.accentSidebarButton:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="CornerRadius" Value="9" />
<Setter Property="BorderBrush" Value="white" />
</Style>
<Style Selector="Button.accentSidebarButton:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="CornerRadius" Value="9" />
<Setter Property="BorderBrush" Value="white" />
<Setter Property="Background" Value="white"/>
<Setter Property="Foreground" Value="#2328C4"/>
</Style>
</Styles>

View File

@@ -28,27 +28,23 @@
<StackPanel Grid.Row="1" Spacing="5" VerticalAlignment="Top" Margin="0 40 0 0">
<Button Content="New Database"
Foreground="White"
Background="Transparent"
BorderThickness="0"
Classes="accentSidebarButton"
FontSize="24"
Cursor="Hand"
Click="CreateNewVault_Click"/>
<Button Content="Open Database"
Foreground="White"
Background="Transparent"
BorderThickness="0"
Classes="accentSidebarButton"
FontSize="24"
Cursor="Hand"
Click="OpenExistingVault_Click"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="25">
<Button Command="{Binding OpenSettingsCommand}">
<Button Command="{Binding OpenSettingsCommand}" Classes="accentSidebarButton">
<Svg Path="/Assets/settings.svg" Width="48" Height="48"/>
</Button>
<Button Command="{Binding OpenAboutCommand}">
<Button Command="{Binding OpenAboutCommand}" Classes="accentSidebarButton">
<Svg Path="/Assets/about.svg" Width="48" Height="48"/>
</Button>
</StackPanel>

View File

@@ -38,23 +38,22 @@
<Button Content="All Passwords"
Width="120"
Height="30"
Foreground="Black"
HorizontalAlignment="Left"/>
</StackPanel>
</Border>
<!-- Save Passwords -->
<Button Content="Save Passwords"
Classes="accentSidebarButton"
Click="SaveButton_Click"
Height="30"
Foreground="White"
HorizontalAlignment="Left"
Margin="0,20,0,0"/>
<Button Content="New Entry"
Classes="accentSidebarButton"
Click="AddEntryButton_Click"
Height="30"
Foreground="White"
HorizontalAlignment="Left"
Margin="0,20,0,0"/>
</StackPanel>
@@ -106,19 +105,7 @@
<Button x:Name="UnlockButton"
Command="{Binding TryUnlock}"
HorizontalAlignment="Center"
Foreground="Black"
Background="#aaa"
Content="Unlock!" />
<StackPanel.Styles>
<Style Selector="Button /template/ ContentPresenter">
<Setter Property="Foreground" Value="#333" />
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="#ccc" />
<Setter Property="Foreground" Value="#444" />
</Style>
</StackPanel.Styles>
</StackPanel>
</DataTemplate>
</Window.DataTemplates>