Compare commits

...

6 Commits

Author SHA1 Message Date
Zhang Dian d958abc1e5 chore: bump version to 12.0.3. 2026-05-25 10:54:00 +08:00
zeje 27810e4ca1 create-dmg (#818)
* create-dmg

* create-dmg-update

* Potential fix for pull request finding

OK

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-25 10:54:00 +08:00
Zhang Dian 0ab36a1ab2 fix: update Avalonia version to 12.0.3, enhance NavItemHost style and correct casing of NuGet.Config in solution file. 2026-05-25 10:13:48 +08:00
Zhang Dian 77acd07732 feat: add page & modal transitions to NavigationPage. (#803)
* feat: add page & modal transitions to NavigationPage.

* chore: x:Name->Name.

* chore: stretch the combo box.
2026-05-21 17:30:35 +08:00
Zhang Dian 7f557bb2c5 feat: update window decoration styles to use transparent backgrounds. 2026-05-21 15:14:24 +08:00
Zhang Dian ec94bdd36d Integrate font management for Linux demo (#822)
* feat: integrate font management by adding Semi.Avalonia.Demo.Fonts project.

* chore: test on ubuntu.

* feat: add linux options.

* feat: update theme settings and adjust window decorations.

* feat: add font to DRM project.

* misc: net8.0->net10.0
2026-05-18 21:16:03 +08:00
37 changed files with 421 additions and 141 deletions
+3
View File
@@ -233,6 +233,9 @@ indent_size = 2
[*.json] [*.json]
indent_size = 2 indent_size = 2
[*.{yml,yaml}]
indent_size = 2
# Shell scripts # Shell scripts
[*.sh] [*.sh]
end_of_line = lf end_of_line = lf
+115
View File
@@ -35,6 +35,14 @@ on:
description: 'macOS arm64 AOT' description: 'macOS arm64 AOT'
default: false default: false
type: boolean type: boolean
osx-x64:
description: 'macOS Intel x64'
default: false
type: boolean
osx-x64-aot:
description: 'macOS Intel x64 AOT'
default: false
type: boolean
android-arm64: android-arm64:
description: 'Android arm64' description: 'Android arm64'
default: false default: false
@@ -65,6 +73,12 @@ on:
osx-arm64-aot: osx-arm64-aot:
type: boolean type: boolean
default: true default: true
osx-x64:
type: boolean
default: true
osx-x64-aot:
type: boolean
default: true
android-arm64: android-arm64:
type: boolean type: boolean
default: true default: true
@@ -180,6 +194,33 @@ jobs:
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Publish osx-arm64 - name: Publish osx-arm64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Create .app bundle and DMG (create-dmg)
run: |
set -euo pipefail
APP_DIR="bundle/Semi.Avalonia.Demo.app"
MACOS_DIR="${APP_DIR}/Contents/MacOS"
mkdir -p "${MACOS_DIR}"
cp -R publish/. "${MACOS_DIR}/"
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
codesign --force --deep --sign - "${APP_DIR}"
mkdir -p dmg_stage
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
brew install create-dmg
rm -f Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
create-dmg \
--volname "Semi Avalonia Demo" \
--window-pos 200 120 \
--window-size 640 400 \
--icon-size 100 \
--icon "Semi.Avalonia.Demo.app" 175 185 \
--hide-extension "Semi.Avalonia.Demo.app" \
--app-drop-link 455 185 \
--skip-jenkins \
"Semi.Avalonia.Demo.Desktop.osx-arm64.dmg" \
"dmg_stage"
- name: Upload a Build Artifact - name: Upload a Build Artifact
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
with: with:
@@ -188,6 +229,62 @@ jobs:
publish publish
!publish/*.pdb !publish/*.pdb
- name: Upload macOS DMG
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
path: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
osx-x64:
if: ${{inputs.osx-x64}}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Publish osx-x64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Create .app bundle and DMG (create-dmg)
run: |
set -euo pipefail
APP_DIR="bundle/Semi.Avalonia.Demo.app"
MACOS_DIR="${APP_DIR}/Contents/MacOS"
mkdir -p "${MACOS_DIR}"
cp -R publish/. "${MACOS_DIR}/"
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
codesign --force --deep --sign - "${APP_DIR}"
mkdir -p dmg_stage
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
brew install create-dmg
rm -f Semi.Avalonia.Demo.Desktop.osx-x64.dmg
create-dmg \
--volname "Semi Avalonia Demo" \
--window-pos 200 120 \
--window-size 640 400 \
--icon-size 100 \
--icon "Semi.Avalonia.Demo.app" 175 185 \
--hide-extension "Semi.Avalonia.Demo.app" \
--app-drop-link 455 185 \
--skip-jenkins \
"Semi.Avalonia.Demo.Desktop.osx-x64.dmg" \
"dmg_stage"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64
path: |
publish
!publish/*.pdb
- name: Upload macOS DMG (Intel)
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
path: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
osx-arm64-aot: osx-arm64-aot:
if: ${{inputs.osx-arm64-aot}} if: ${{inputs.osx-arm64-aot}}
runs-on: macos-latest runs-on: macos-latest
@@ -206,6 +303,24 @@ jobs:
publish publish
!publish/*.pdb !publish/*.pdb
osx-x64-aot:
if: ${{inputs.osx-x64-aot}}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Enable Native AOT in .csproj
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
- name: Publish osx-x64 AOT
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
path: |
publish
!publish/*.pdb
android-arm64: android-arm64:
if: ${{inputs.android-arm64 }} if: ${{inputs.android-arm64 }}
runs-on: windows-latest runs-on: windows-latest
+6
View File
@@ -58,6 +58,10 @@ jobs:
zip -rj Semi.Avalonia.Demo.Desktop.osx-arm64.zip Semi.Avalonia.Demo.Desktop.osx-arm64 zip -rj Semi.Avalonia.Demo.Desktop.osx-arm64.zip Semi.Avalonia.Demo.Desktop.osx-arm64
cd Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT cd Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT
zip -r ../Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT.zip . zip -r ../Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT.zip .
cd "${GITHUB_WORKSPACE}"
zip -rj Semi.Avalonia.Demo.Desktop.osx-x64.zip Semi.Avalonia.Demo.Desktop.osx-x64
cd Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
zip -r ../Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT.zip .
- name: Display structure of zipped files - name: Display structure of zipped files
run: ls -R run: ls -R
@@ -72,3 +76,5 @@ jobs:
nugets/*.nupkg nugets/*.nupkg
android-arm64/*.apk android-arm64/*.apk
*.zip *.zip
Semi.Avalonia.Demo.Desktop.osx-arm64.dmg/Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
Semi.Avalonia.Demo.Desktop.osx-x64.dmg/Semi.Avalonia.Demo.Desktop.osx-x64.dmg
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionOverrideEnabled>true</CentralPackageVersionOverrideEnabled> <CentralPackageVersionOverrideEnabled>true</CentralPackageVersionOverrideEnabled>
<AvaloniaVersion>12.0.1</AvaloniaVersion> <AvaloniaVersion>12.0.3</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion> <DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup> </PropertyGroup>
View File
+2 -2
View File
@@ -3,6 +3,7 @@
<Project Path="demo/Semi.Avalonia.Demo.Android/Semi.Avalonia.Demo.Android.csproj"/> <Project Path="demo/Semi.Avalonia.Demo.Android/Semi.Avalonia.Demo.Android.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj"/> <Project Path="demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj"/> <Project Path="demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Fonts/Semi.Avalonia.Demo.Fonts.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj"/> <Project Path="demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj"/> <Project Path="demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj"/>
</Folder> </Folder>
@@ -17,11 +18,10 @@
<Folder Name="/Solution Items/"> <Folder Name="/Solution Items/">
<File Path="Directory.Packages.props"/> <File Path="Directory.Packages.props"/>
<File Path="global.json"/> <File Path="global.json"/>
<File Path="Nuget.Config"/> <File Path="NuGet.Config"/>
</Folder> </Folder>
<Folder Name="/Solution Items/Demo/"> <Folder Name="/Solution Items/Demo/">
<File Path="demo/Directory.Build.targets"/> <File Path="demo/Directory.Build.targets"/>
<File Path="demo/global.json"/>
</Folder> </Folder>
<Folder Name="/Solution Items/Src/"> <Folder Name="/Solution Items/Src/">
<File Path="src/Directory.Build.props"/> <File Path="src/Directory.Build.props"/>
+1 -1
View File
@@ -1,6 +1,6 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<AvaloniaVersion>12.0.2</AvaloniaVersion> <AvaloniaVersion>12.0.3</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion> <DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup> </PropertyGroup>
@@ -2,6 +2,7 @@
using Android.Runtime; using Android.Runtime;
using Avalonia; using Avalonia;
using Avalonia.Android; using Avalonia.Android;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Android; namespace Semi.Avalonia.Demo.Android;
@@ -1,16 +0,0 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Android;
public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Android/Assets#Source Han Sans CN";
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
});
}
@@ -21,7 +21,6 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/> <AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -31,5 +30,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/> <ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Semi.Avalonia.Demo.Desktop</string>
<key>CFBundleIdentifier</key>
<string>org.avaloniaui.SemiAvaloniaDemo</string>
<key>CFBundleName</key>
<string>Semi Avalonia Demo</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(Version)</string>
<key>CFBundleVersion</key>
<string>$(Version)</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
</dict>
</plist>
+16 -10
View File
@@ -2,8 +2,10 @@
using Avalonia; using Avalonia;
using Avalonia.Dialogs; using Avalonia.Dialogs;
using Avalonia.Media; using Avalonia.Media;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Desktop; namespace Semi.Avalonia.Demo.Desktop;
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
sealed class Program sealed class Program
{ {
@@ -11,24 +13,28 @@ sealed class Program
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break. // yet and stuff might break.
[STAThread] [STAThread]
public static void Main(string[] args) => BuildAvaloniaApp() public static void Main(string[] args)
.With(new FontManagerOptions
{ {
FontFallbacks = var appBuilder = BuildAvaloniaApp();
[ if (!OperatingSystem.IsLinux())
new FontFallback appBuilder.With(new FontManagerOptions
{ {
FontFamily = new FontFamily("Microsoft YaHei") FontFallbacks = [new FontFallback { FontFamily = new FontFamily("Microsoft YaHei") }]
});
appBuilder.StartWithClassicDesktopLifetime(args);
} }
]
})
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer. // Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>() {
var appBuilder = AppBuilder.Configure<App>()
.UseManagedSystemDialogs() .UseManagedSystemDialogs()
.UsePlatformDetect() .UsePlatformDetect()
.With(new Win32PlatformOptions()) .With(new Win32PlatformOptions())
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
.LogToTrace(); .LogToTrace();
if (OperatingSystem.IsLinux()) appBuilder.WithSourceHanSansCNFont();
return appBuilder;
}
} }
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Version>1.0.0</Version>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon> <ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
@@ -28,5 +29,28 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/> <ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup> </ItemGroup>
<UsingTask TaskName="ExpandMacOSPlistVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFile ParameterType="System.String" Required="true"/>
<OutputFile ParameterType="System.String" Required="true"/>
<AppVersion ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs"><![CDATA[
var token = "$" + "(Version)";
System.IO.File.WriteAllText(
OutputFile,
System.IO.File.ReadAllText(InputFile).Replace(token, AppVersion));
]]></Code>
</Task>
</UsingTask>
<Target Name="ExpandMacOSInfoPlist" AfterTargets="Publish">
<ExpandMacOSPlistVersion
InputFile="$(MSBuildProjectDirectory)/Info-macOS.plist"
OutputFile="$(PublishDir)Info-macOS.plist"
AppVersion="$(Version)"/>
</Target>
</Project> </Project>
+5 -3
View File
@@ -4,8 +4,10 @@ using System.Linq;
using System.Threading; using System.Threading;
using Avalonia; using Avalonia;
using Avalonia.Dialogs; using Avalonia.Dialogs;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Drm; namespace Semi.Avalonia.Demo.Drm;
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
sealed class Program sealed class Program
{ {
@@ -40,7 +42,8 @@ sealed class Program
=> AppBuilder.Configure<App>() => AppBuilder.Configure<App>()
.UseManagedSystemDialogs() .UseManagedSystemDialogs()
.UsePlatformDetect() .UsePlatformDetect()
.With(new Win32PlatformOptions()) .With(new X11PlatformOptions { EnableDrawnDecorations = true })
.WithSourceHanSansCNFont()
.LogToTrace(); .LogToTrace();
private static void SilenceConsole() private static void SilenceConsole()
@@ -50,7 +53,6 @@ sealed class Program
Console.CursorVisible = false; Console.CursorVisible = false;
while (true) while (true)
Console.ReadKey(true); Console.ReadKey(true);
}) }) { IsBackground = true }.Start();
{ IsBackground = true }.Start();
} }
} }
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon> <ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
@@ -29,5 +29,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/> <ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Fonts;
public static class AvaloniaAppBuilderExtensions
{
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder)
{
const string uri = "avares://Semi.Avalonia.Demo.Fonts/Assets#Source Han Sans CN";
return builder.With(new FontManagerOptions
{
DefaultFamilyName = uri, FontFallbacks = [new FontFallback { FontFamily = new FontFamily(uri) }]
});
}
}
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia"/>
</ItemGroup>
</Project>
@@ -1,16 +0,0 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Web;
public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Web/Assets#Source Han Sans CN";
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
});
}
+1
View File
@@ -2,6 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia; using Avalonia;
using Avalonia.Browser; using Avalonia.Browser;
using Semi.Avalonia.Demo.Fonts;
[assembly: SupportedOSPlatform("browser")] [assembly: SupportedOSPlatform("browser")]
@@ -6,15 +6,12 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Browser"/> <PackageReference Include="Avalonia.Browser"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/> <ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>
+1
View File
@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi" xmlns:semi="https://irihi.tech/semi"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
RequestedThemeVariant="Default"
x:DataType="vm:ApplicationViewModel"> x:DataType="vm:ApplicationViewModel">
<Application.Styles> <Application.Styles>
<semi:SemiTheme Locale="zh-CN" /> <semi:SemiTheme Locale="zh-CN" />
+16 -12
View File
@@ -1,6 +1,6 @@
using System;
using Avalonia; using Avalonia;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Semi.Avalonia.Demo.ViewModels; using Semi.Avalonia.Demo.ViewModels;
using Semi.Avalonia.Demo.Views; using Semi.Avalonia.Demo.Views;
@@ -15,22 +15,26 @@ public partial class App : Application
#if DEBUG #if DEBUG
this.AttachDeveloperTools(); this.AttachDeveloperTools();
#endif #endif
this.DataContext = new ApplicationViewModel(); DataContext = new ApplicationViewModel();
if (OperatingSystem.IsLinux())
{
Resources.Add("DefaultFontFamily", null);
}
} }
public override void OnFrameworkInitializationCompleted() public override void OnFrameworkInitializationCompleted()
{ {
switch (ApplicationLifetime) if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{ {
case IClassicDesktopStyleApplicationLifetime desktop: desktop.MainWindow = new MainWindow { DataContext = new MainViewModel() };
// Line below is needed to remove Avalonia data validation. }
// Without this line you will get duplicate validations from both Avalonia and CT else if (ApplicationLifetime is IActivityApplicationLifetime applicationLifetime)
// BindingPlugins.DataValidators.RemoveAt(0); {
desktop.MainWindow = new MainWindow(); applicationLifetime.MainViewFactory = () => new MainView { DataContext = new MainViewModel() };
break; }
case ISingleViewApplicationLifetime singleView: else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
singleView.MainView = new MainView(); {
break; singleViewPlatform.MainView = new MainView { DataContext = new MainViewModel() };
} }
this.RegisterFollowSystemTheme(); this.RegisterFollowSystemTheme();
@@ -12,7 +12,7 @@
<ScrollViewer DockPanel.Dock="Right" Width="260"> <ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8"> <StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16" /> <TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16" />
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="13" /> <TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="14" />
<Button Content="Push Page" <Button Content="Push Page"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@@ -26,6 +26,20 @@
<Separator /> <Separator />
<TextBlock Text="Modal Actions" FontWeight="SemiBold" FontSize="14" />
<Button Name="PushModalButton"
Content="Push Modal"
HorizontalAlignment="Stretch"
Click="OnPushModal" />
<Button Name="PopModalButton"
Content="Pop Modal"
HorizontalAlignment="Stretch"
Click="OnPopModal" />
<Button Name="PopAllModalsButton"
Content="Pop All Modals"
HorizontalAlignment="Stretch"
Click="OnPopAllModals" />
<TextBlock Text="Options" FontWeight="SemiBold" FontSize="14" /> <TextBlock Text="Options" FontWeight="SemiBold" FontSize="14" />
<CheckBox Name="HasNavBarCheck" <CheckBox Name="HasNavBarCheck"
@@ -35,20 +49,38 @@
<CheckBox Name="HasBackButtonCheck" <CheckBox Name="HasBackButtonCheck"
Content="Has Back Button" Content="Has Back Button"
IsChecked="True" IsChecked="True"
IsCheckedChanged="OnHasBackButonChanged" /> IsCheckedChanged="OnHasBackButtonChanged" />
<CheckBox Name="HasShadowCheck"
Content="Has Shadow"
IsChecked="True"
IsCheckedChanged="OnHasShadowChanged" />
<CheckBox Name="large" Content="Large" />
<Separator />
<TextBlock Text="Modal Transition" FontWeight="SemiBold" FontSize="14" />
<ComboBox Name="TransitionCombo"
SelectedIndex="0"
HorizontalAlignment="Stretch"
SelectionChanged="OnTransitionChanged">
<ComboBoxItem Content="Slide from Bottom" />
<ComboBoxItem Content="CrossFade" />
<ComboBoxItem Content="None" />
</ComboBox>
<Separator /> <Separator />
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" /> <TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
<TextBlock Name="StatusText" <TextBlock Name="StatusText"
Text="Depth: 1" Text="Depth: 1"
Opacity="0.7"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<TextBlock Name="HeaderText" <TextBlock Name="HeaderText"
Text="Current: Home" Text="Current: Home"
Opacity="0.7"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<ToggleSwitch Content="Large" Name="large" /> <TextBlock Name="ModalText"
Text="Modals: 0"
TextWrapping="Wrap" />
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
@@ -1,3 +1,5 @@
using System;
using Avalonia.Animation;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
@@ -6,6 +8,7 @@ namespace Semi.Avalonia.Demo.Pages;
public partial class NavigationPageDemo : UserControl public partial class NavigationPageDemo : UserControl
{ {
private int _pageCount; private int _pageCount;
private int _modalCount;
public NavigationPageDemo() public NavigationPageDemo()
{ {
@@ -15,7 +18,7 @@ public partial class NavigationPageDemo : UserControl
private async void OnLoaded(object? sender, RoutedEventArgs e) private async void OnLoaded(object? sender, RoutedEventArgs e)
{ {
await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages.", 0), null); await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages/modals.", 0), null);
UpdateStatus(); UpdateStatus();
} }
@@ -42,6 +45,27 @@ public partial class NavigationPageDemo : UserControl
UpdateStatus(); UpdateStatus();
} }
private async void OnPushModal(object? sender, RoutedEventArgs e)
{
_modalCount++;
var modal = NavigationDemoHelper.MakePage($"Modal {_modalCount}", "This page was presented modally.\nTap 'Pop Modal' to dismiss.", _modalCount);
await DemoNav.PushModalAsync(modal);
UpdateStatus();
}
private async void OnPopModal(object? sender, RoutedEventArgs e)
{
await DemoNav.PopModalAsync();
UpdateStatus();
}
private async void OnPopAllModals(object? sender, RoutedEventArgs e)
{
await DemoNav.PopAllModalsAsync();
_modalCount = 0;
UpdateStatus();
}
private void OnHasNavBarChanged(object? sender, RoutedEventArgs e) private void OnHasNavBarChanged(object? sender, RoutedEventArgs e)
{ {
if (DemoNav == null) if (DemoNav == null)
@@ -50,7 +74,7 @@ public partial class NavigationPageDemo : UserControl
NavigationPage.SetHasNavigationBar(DemoNav.CurrentPage, HasNavBarCheck.IsChecked == true); NavigationPage.SetHasNavigationBar(DemoNav.CurrentPage, HasNavBarCheck.IsChecked == true);
} }
private void OnHasBackButonChanged(object? sender, RoutedEventArgs e) private void OnHasBackButtonChanged(object? sender, RoutedEventArgs e)
{ {
if (DemoNav == null) if (DemoNav == null)
return; return;
@@ -58,9 +82,30 @@ public partial class NavigationPageDemo : UserControl
NavigationPage.SetHasBackButton(DemoNav.CurrentPage, HasBackButtonCheck.IsChecked == true); NavigationPage.SetHasBackButton(DemoNav.CurrentPage, HasBackButtonCheck.IsChecked == true);
} }
private void OnHasShadowChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
return;
if (DemoNav.CurrentPage != null)
DemoNav.HasShadow = HasShadowCheck.IsChecked == true;
}
private void OnTransitionChanged(object? sender, SelectionChangedEventArgs e)
{
if (DemoNav == null)
return;
DemoNav.ModalTransition = TransitionCombo.SelectedIndex switch
{
1 => new CrossFade(TimeSpan.FromMilliseconds(250)),
2 => null,
_ => new PageSlide(TimeSpan.FromMilliseconds(300), PageSlide.SlideAxis.Vertical)
};
}
private void UpdateStatus() private void UpdateStatus()
{ {
StatusText.Text = $"Depth: {DemoNav.StackDepth}"; StatusText.Text = $"Depth: {DemoNav.StackDepth}";
HeaderText.Text = $"Current: {DemoNav.CurrentPage?.Header ?? "(none)"}"; HeaderText.Text = $"Current: {DemoNav.CurrentPage?.Header ?? "(none)"}";
ModalText.Text = $"Modals: {DemoNav.ModalStack.Count}";
} }
} }
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
@@ -20,6 +20,7 @@
<Style Selector="Border.NavItemHost"> <Style Selector="Border.NavItemHost">
<Setter Property="Margin" Value="6,0" /> <Setter Property="Margin" Value="6,0" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="{DynamicResource SemiBorderRadiusSmall}" />
</Style> </Style>
<Style Selector="Border.NavItemHost.Selected"> <Style Selector="Border.NavItemHost.Selected">
-5
View File
@@ -1,5 +0,0 @@
{
"sdk": {
"version": "8.0"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "8.0.0", "version": "10.0.0",
"rollForward": "latestMajor", "rollForward": "latestMajor",
"allowPrerelease": true "allowPrerelease": true
} }
@@ -2,8 +2,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks> <TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.1</Version> <Version>12.0.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.1</PackageReleaseNotes> <PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.3</PackageReleaseNotes>
<Title>Semi.Avalonia.ColorPicker</Title> <Title>Semi.Avalonia.ColorPicker</Title>
</PropertyGroup> </PropertyGroup>
@@ -8,6 +8,26 @@
<ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage"> <ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" /> <Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" />
<Setter Property="PageTransition">
<PageSlide Duration="0:0:0.3" Orientation="Horizontal" FillMode="Forward">
<PageSlide.SlideInEasing>
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
</PageSlide.SlideInEasing>
<PageSlide.SlideOutEasing>
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
</PageSlide.SlideOutEasing>
</PageSlide>
</Setter>
<Setter Property="ModalTransition">
<PageSlide Duration="0:0:0.25" Orientation="Vertical" FillMode="Forward">
<PageSlide.SlideInEasing>
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
</PageSlide.SlideInEasing>
<PageSlide.SlideOutEasing>
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
</PageSlide.SlideOutEasing>
</PageSlide>
</Setter>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="NavigationPage"> <ControlTemplate TargetType="NavigationPage">
<Panel ClipToBounds="True"> <Panel ClipToBounds="True">
@@ -46,8 +46,8 @@
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations"> <ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
<Setter Property="DefaultTitleBarHeight" Value="32" /> <Setter Property="DefaultTitleBarHeight" Value="32" />
<Setter Property="DefaultFrameThickness" Value="1" /> <Setter Property="DefaultFrameThickness" Value="4" />
<Setter Property="DefaultShadowThickness" Value="8" /> <!-- <Setter Property="DefaultShadowThickness" Value="8" /> -->
<Setter Property="Template"> <Setter Property="Template">
<WindowDrawnDecorationsTemplate> <WindowDrawnDecorationsTemplate>
<WindowDrawnDecorationsContent> <WindowDrawnDecorationsContent>
+2 -2
View File
@@ -2,8 +2,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks> <TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.1</Version> <Version>12.0.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.1</PackageReleaseNotes> <PackageReleaseNotes>Update to Semi.Avalonia 12.0.3</PackageReleaseNotes>
<Title>Semi.Avalonia</Title> <Title>Semi.Avalonia</Title>
</PropertyGroup> </PropertyGroup>
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" /> <StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" /> <SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" /> <StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" /> <StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />
@@ -1,5 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorWindow" /> <SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorWindowText" />
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorHotlight" /> <StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorHotlight" /> <StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorHotlight" />
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" /> <StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" /> <SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" /> <StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" /> <StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />