feat: add default Theme to SplashWindow.

This commit is contained in:
Zhang Dian
2025-02-24 15:44:37 +08:00
parent 92011c79ca
commit b20137e8aa
4 changed files with 32 additions and 13 deletions

View File

@@ -2,22 +2,11 @@
x:Class="Ursa.Demo.Views.MainSplashWindow" x:Class="Ursa.Demo.Views.MainSplashWindow"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:iri="https://irihi.tech/shared" xmlns:iri="https://irihi.tech/shared"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa" xmlns:u="https://irihi.tech/ursa"
Title="MainSplashWindow" Title="MainSplashWindow"
Width="400" Width="400"
Height="400" Height="400">
d:DesignHeight="450"
d:DesignWidth="800"
CountDown="0:0:3"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="0"
ExtendClientAreaToDecorationsHint="True"
SystemDecorations="None"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid <Grid
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -51,4 +40,4 @@
Text="Aesthetic Evolution of Productivity" /> Text="Aesthetic Evolution of Productivity" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</u:SplashWindow> </u:SplashWindow>

View File

@@ -0,0 +1,27 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:SplashWindow}" TargetType="u:SplashWindow">
<Setter Property="CountDown" Value="0:0:3" />
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
<Setter Property="ExtendClientAreaChromeHints" Value="NoChrome" />
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="0" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
<Setter Property="WindowStartupLocation" Value="CenterScreen" />
<Setter Property="SystemDecorations">
<OnPlatform>
<On Options="Default, Windows, macOS">
<SystemDecorations>Full</SystemDecorations>
</On>
<On Options="Linux">
<SystemDecorations>None</SystemDecorations>
</On>
</OnPlatform>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -56,5 +56,6 @@
<ResourceInclude Source="UrsaWindow.axaml"/> <ResourceInclude Source="UrsaWindow.axaml"/>
<ResourceInclude Source="PinCode.axaml" /> <ResourceInclude Source="PinCode.axaml" />
<ResourceInclude Source="PathPicker.axaml"/> <ResourceInclude Source="PathPicker.axaml"/>
<ResourceInclude Source="SplashWindow.axaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -8,6 +8,8 @@ namespace Ursa.Controls;
public abstract class SplashWindow: Window public abstract class SplashWindow: Window
{ {
protected override Type StyleKeyOverride => typeof(SplashWindow);
public static readonly StyledProperty<TimeSpan?> CountDownProperty = AvaloniaProperty.Register<SplashWindow, TimeSpan?>( public static readonly StyledProperty<TimeSpan?> CountDownProperty = AvaloniaProperty.Register<SplashWindow, TimeSpan?>(
nameof(CountDown)); nameof(CountDown));