feat: initialize Avalonia demo.

This commit is contained in:
NaBian committed 2023-12-10 16:41:03 +08:00
1 parent babf40e59f
commit 646c4b0e01
31 files changed
+687 -19

No files matched your search

@@ -0,0 +1,102 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type Button}" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{DynamicResource DefaultCornerRadius}" />
<Setter Property="Padding" Value="{DynamicResource DefaultControlPadding}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<ContentPresenter x:Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
RecognizesAccessKey="True"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource BorderBrush}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Opacity" Value=".4" />
</Style>
<Style Selector="^.primary">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
</Style>
<Style Selector="^.success">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="Background" Value="{DynamicResource SuccessBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SuccessBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
</Style>
<Style Selector="^.info">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="Background" Value="{DynamicResource InfoBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource InfoBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
</Style>
<Style Selector="^.warning">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="Background" Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource WarningBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
</Style>
<Style Selector="^.danger">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="Background" Value="{DynamicResource DangerBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource DangerBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Opacity" Value=".9" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Opacity" Value=".6" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,20 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type ContentControl}" TargetType="ContentControl">
<Setter Property="Template">
<ControlTemplate TargetType="ContentControl">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,17 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<MergeResourceInclude Source="avares://HandyControl/Themes/Basic/Brushes.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ContentControl.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/UserControl.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector=":is(UserControl)">
<Setter Property="Theme" Value="{DynamicResource {x:Type UserControl}}" />
</Style>
</Styles>
@@ -0,0 +1,20 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type UserControl}" TargetType="UserControl">
<Setter Property="Template">
<ControlTemplate TargetType="UserControl">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,31 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:ClassModifier="internal">
<ControlTheme x:Key="{x:Type Window}" TargetType="Window">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource RegionBrush}" />
<Setter Property="TopLevel.SystemBarColor" Value="{DynamicResource RegionBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Template">
<ControlTemplate TargetType="Window">
<Panel>
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
<Panel Background="Transparent" Margin="{TemplateBinding WindowDecorationMargin}" />
<VisualLayerManager>
<VisualLayerManager.ChromeOverlayLayer>
<TitleBar />
</VisualLayerManager.ChromeOverlayLayer>
<ContentPresenter Name="PART_ContentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</VisualLayerManager>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>