feat: add UserControl, add Window Resources, update folder structure.

This commit is contained in:
rabbitism 2022-11-04 23:13:57 +08:00
parent 9567d27878
commit b58a38f22e
19 changed files with 71 additions and 19 deletions

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Themes.Semi", "src\Avalonia.Themes.Semi\Avalonia.Themes.Semi.csproj", "{807DB45D-14B8-4238-A9F2-24C530BE9F7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Demo", "Semi.Demo\Semi.Demo.csproj", "{2EDDD805-4AA2-4C20-9927-F8CB6270797C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Demo", "src\Semi.Demo\Semi.Demo.csproj", "{9BD82D56-2330-4592-9275-C78BAF956045}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +17,10 @@ Global
{807DB45D-14B8-4238-A9F2-24C530BE9F7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{807DB45D-14B8-4238-A9F2-24C530BE9F7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{807DB45D-14B8-4238-A9F2-24C530BE9F7A}.Release|Any CPU.Build.0 = Release|Any CPU
{2EDDD805-4AA2-4C20-9927-F8CB6270797C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EDDD805-4AA2-4C20-9927-F8CB6270797C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EDDD805-4AA2-4C20-9927-F8CB6270797C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EDDD805-4AA2-4C20-9927-F8CB6270797C}.Release|Any CPU.Build.0 = Release|Any CPU
{9BD82D56-2330-4592-9275-C78BAF956045}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BD82D56-2330-4592-9275-C78BAF956045}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BD82D56-2330-4592-9275-C78BAF956045}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BD82D56-2330-4592-9275-C78BAF956045}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -9,8 +9,4 @@
<PackageReference Include="Avalonia" Version="11.0.0-preview3" />
</ItemGroup>
<ItemGroup>
<Folder Include="Themes\Dark" />
</ItemGroup>
</Project>

View File

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Controls/UserControl.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Controls/Window.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -0,0 +1,20 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type UserControl}" TargetType="UserControl">
<Setter Property="Template">
<ControlTemplate TargetType="UserControl">
<ContentPresenter Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@ -1,13 +1,13 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type Window}" TargetType="Window">
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}"/>
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}"/>
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}"/>
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="Background" Value="{DynamicResource BrushWindowDefaultBackground}"/>
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource BrushWindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource BrushWindowDefaultForeground}"/>
<Setter Property="FontSize" Value="{DynamicResource FontDefaultFontSize}"/>
<Setter Property="FontFamily" Value="{DynamicResource FontDefaultFontFamily}" />
<Setter Property="Template">
<ControlTemplate>
<ControlTemplate TargetType="Window">
<Panel>
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />

View File

@ -0,0 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<!-- Add Resources Here -->
<sys:Double x:Key="FontDefaultFontSize">14</sys:Double>
<FontFamily x:Key="FontDefaultFontFamily">Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif</FontFamily>
</ResourceDictionary>

View File

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Dark/Palette.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Dark/Window.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -0,0 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
</ResourceDictionary>

View File

@ -0,0 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="BrushWindowDefaultBackground" Color="Black"/>
<SolidColorBrush x:Key="BrushWindowDefaultForeground" Color="White"/>
</ResourceDictionary>

View File

@ -0,0 +1,9 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Dark/Dark.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Base.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Controls/Controls.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="WindowDefaultBackground" Color="White"/>
<SolidColorBrush x:Key="WindowDefaultForeground" Color="Black"/>
<SolidColorBrush x:Key="BrushWindowDefaultBackground" Color="White"/>
<SolidColorBrush x:Key="BrushWindowDefaultForeground" Color="Black"/>
</ResourceDictionary>

View File

@ -4,6 +4,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Light/Light.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/Base.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Controls/Controls.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -7,7 +7,7 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/LightTheme.axaml"/>
<ResourceInclude Source="avares://Avalonia.Themes.Semi/Themes/DarkTheme.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@ -25,6 +25,6 @@
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\Avalonia.Themes.Semi\Avalonia.Themes.Semi.csproj" />
<ProjectReference Include="..\Avalonia.Themes.Semi\Avalonia.Themes.Semi.csproj" />
</ItemGroup>
</Project>