Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
6c8f3a4772 Implement parent culture fallback for OverrideLocaleResources
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
2025-07-28 15:18:47 +00:00
copilot-swe-agent[bot]
8ac1e010a3 Initial plan 2025-07-28 15:05:58 +00:00
202 changed files with 4396 additions and 4089 deletions

View File

@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
env: env:
PROJECT_PATH: demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj PROJECT_PATH: demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj
OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/bin/Release/net10.0-browser/publish/wwwroot OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/bin/Release/net8.0-browser/publish/wwwroot
on: on:
workflow_dispatch: workflow_dispatch:
@@ -11,13 +11,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.1.1
- name: Setup dotnet - name: Setup .NET 8
uses: actions/setup-dotnet@v5 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: | dotnet-version: 8.0.x
10.0.x
- name: Install wasm-tools - name: Install wasm-tools
run: dotnet workload install wasm-tools run: dotnet workload install wasm-tools

View File

@@ -31,7 +31,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Get Version - name: Get Version
run: | run: |

View File

@@ -47,7 +47,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Pack Semi.Avalonia - name: Pack Semi.Avalonia
if: ${{ inputs.Semi_Avalonia }} if: ${{ inputs.Semi_Avalonia }}

View File

@@ -75,7 +75,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Publish win-x64 - name: Publish win-x64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Upload a Build Artifact - name: Upload a Build Artifact
@@ -91,7 +91,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Enable Native AOT in .csproj - 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 run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
- name: Publish win-x64 AOT - name: Publish win-x64 AOT
@@ -109,7 +109,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Publish linux-x64 - name: Publish linux-x64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Upload a Build Artifact - name: Upload a Build Artifact
@@ -125,7 +125,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Enable Native AOT in .csproj - 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 run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
- name: Publish linux-x64 AOT - name: Publish linux-x64 AOT
@@ -143,7 +143,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Publish linux-x64 DRM - name: Publish linux-x64 DRM
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Upload a Build Artifact - name: Upload a Build Artifact
@@ -159,7 +159,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Enable Native AOT in .csproj - name: Enable Native AOT in .csproj
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj
- name: Publish linux-x64 AOT - name: Publish linux-x64 AOT
@@ -177,7 +177,7 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- 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: Upload a Build Artifact - name: Upload a Build Artifact
@@ -193,7 +193,7 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Enable Native AOT in .csproj - 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 run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
- name: Publish osx-arm64 AOT - name: Publish osx-arm64 AOT
@@ -211,13 +211,13 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v4.2.2
- name: Install Android workload - name: CD Android
run: dotnet workload install android run: cd demo/Semi.Avalonia.Demo.Android
- name: Restore Dependencies - name: Restore Dependencies
run: dotnet restore demo/Semi.Avalonia.Demo.Android run: dotnet restore
- name: Publish Android - name: Publish Android
run: dotnet publish demo/Semi.Avalonia.Demo.Android -c Release -f net10.0-android --no-restore -o publish /p:RuntimeIdentifier=android-arm64 run: dotnet publish demo/Semi.Avalonia.Demo.Android -c Release -f net8.0-android --no-restore -o publish /p:RuntimeIdentifier=android-arm64
- name: Upload a Build Artifact - name: Upload a Build Artifact
uses: actions/upload-artifact@v4.6.2 uses: actions/upload-artifact@v4.6.2
with: with:

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="avalonia-nightly" value="https://nuget-feed-nightly.avaloniaui.net/v3/index.json" />
</packageSources>
</configuration>

View File

@@ -75,12 +75,13 @@ We offer limited free community support for Semi Avalonia and Ursa. If you have
## Version compatibility ## Version compatibility
| Semi Avalonia Version | Avalonia Version | | Semi Design Version | Avalonia Version |
|:----------------------|:-----------------| |:--------------------|:-----------------|
| 11.3.7 | >=11.3.7 | | 11.2.1 | >=11.2.1 |
| 11.2.1 | >=11.2.1 | | 11.2.0 | 11.2.0 |
| 11.2.0 | End of Life | | 11.1.0 | >=11.1.0 |
| 11.1.x | End of Life | | 11.0.7 | >=11.0.7 |
| 11.0.1 | <=11.0.6 |
## Credits ## Credits

View File

@@ -75,12 +75,13 @@ dotnet add package Semi.Avalonia.AvaloniaEdit
## 版本兼容性 ## 版本兼容性
| Semi Avalonia Version | Avalonia Version | | Semi Design Version | Avalonia Version |
|:----------------------|:-----------------| |:--------------------|:-----------------|
| 11.3.7 | >=11.3.7 | | 11.2.1 | >=11.2.1 |
| 11.2.1 | >=11.2.1 | | 11.2.0 | 11.2.0 |
| 11.2.0 | End of Life | | 11.1.0 | >=11.1.0 |
| 11.1.x | End of Life | | 11.0.7 | >=11.0.7 |
| 11.0.1 | <=11.0.6 |
## 致谢 ## 致谢

99
Semi.Avalonia.sln Normal file
View File

@@ -0,0 +1,99 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia", "src\Semi.Avalonia\Semi.Avalonia.csproj", "{90D0B063-BC64-40AB-A56C-AC11909CF410}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{B1E6A7D4-0AFB-4D32-9969-5FBDAC0CFF3E}"
ProjectSection(SolutionItems) = preProject
demo\Directory.Build.props = demo\Directory.Build.props
demo\global.json = demo\global.json
src\Package.props = src\Package.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Action", "{318534A1-1CC3-40FB-B4AE-736F94465232}"
ProjectSection(SolutionItems) = preProject
.github\workflows\deploy.yml = .github\workflows\deploy.yml
.github\workflows\pack.yml = .github\workflows\pack.yml
.github\workflows\pack-nightly.yml = .github\workflows\pack-nightly.yml
.github\workflows\publish.yml = .github\workflows\publish.yml
.github\workflows\release-tag.yml = .github\workflows\release-tag.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{43091528-9509-43CB-A003-9C5C11E96DD6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.Demo.Desktop", "demo\Semi.Avalonia.Demo.Desktop\Semi.Avalonia.Demo.Desktop.csproj", "{2ADCA724-2B6D-46EC-87F7-604D7918B89A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.Demo.Web", "demo\Semi.Avalonia.Demo.Web\Semi.Avalonia.Demo.Web.csproj", "{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.Demo", "demo\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj", "{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.DataGrid", "src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj", "{8A90C292-8761-4F70-8E1F-EFC097FEADB3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.ColorPicker", "src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj", "{0B64C2F2-FDCD-48E4-AB9D-7CCC63B006CA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semi.Avalonia.Demo.Android", "demo\Semi.Avalonia.Demo.Android\Semi.Avalonia.Demo.Android.csproj", "{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Avalonia.Demo.Drm", "demo\Semi.Avalonia.Demo.Drm\Semi.Avalonia.Demo.Drm.csproj", "{86D93406-412A-4429-93B2-92AAD0407784}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semi.Avalonia.TreeDataGrid", "src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj", "{398D2998-0835-41F5-99A3-608CAB8051E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90D0B063-BC64-40AB-A56C-AC11909CF410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90D0B063-BC64-40AB-A56C-AC11909CF410}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90D0B063-BC64-40AB-A56C-AC11909CF410}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90D0B063-BC64-40AB-A56C-AC11909CF410}.Release|Any CPU.Build.0 = Release|Any CPU
{2ADCA724-2B6D-46EC-87F7-604D7918B89A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2ADCA724-2B6D-46EC-87F7-604D7918B89A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ADCA724-2B6D-46EC-87F7-604D7918B89A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ADCA724-2B6D-46EC-87F7-604D7918B89A}.Release|Any CPU.Build.0 = Release|Any CPU
{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0}.Release|Any CPU.Build.0 = Release|Any CPU
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0}.Release|Any CPU.Build.0 = Release|Any CPU
{8A90C292-8761-4F70-8E1F-EFC097FEADB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A90C292-8761-4F70-8E1F-EFC097FEADB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A90C292-8761-4F70-8E1F-EFC097FEADB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A90C292-8761-4F70-8E1F-EFC097FEADB3}.Release|Any CPU.Build.0 = Release|Any CPU
{0B64C2F2-FDCD-48E4-AB9D-7CCC63B006CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B64C2F2-FDCD-48E4-AB9D-7CCC63B006CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B64C2F2-FDCD-48E4-AB9D-7CCC63B006CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B64C2F2-FDCD-48E4-AB9D-7CCC63B006CA}.Release|Any CPU.Build.0 = Release|Any CPU
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F}.Release|Any CPU.Build.0 = Release|Any CPU
{86D93406-412A-4429-93B2-92AAD0407784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86D93406-412A-4429-93B2-92AAD0407784}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86D93406-412A-4429-93B2-92AAD0407784}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86D93406-412A-4429-93B2-92AAD0407784}.Release|Any CPU.Build.0 = Release|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{398D2998-0835-41F5-99A3-608CAB8051E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2ADCA724-2B6D-46EC-87F7-604D7918B89A} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{69A2C77D-6DB7-4AE4-B179-D1F5CF5E2DF0} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{D789AEDB-EBDF-4450-8E8E-B4A03FB257B0} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{0C81FC1C-5D2D-478A-9876-923A0C85EC2F} = {43091528-9509-43CB-A003-9C5C11E96DD6}
{86D93406-412A-4429-93B2-92AAD0407784} = {43091528-9509-43CB-A003-9C5C11E96DD6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7CA41ED3-2CED-40CC-AA21-28C3B42B1E86}
EndGlobalSection
EndGlobal

View File

@@ -1,28 +0,0 @@
<Solution>
<Folder Name="/Demo/">
<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.Drm/Semi.Avalonia.Demo.Drm.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj"/>
</Folder>
<Folder Name="/GitHub Action/">
<File Path=".github/workflows/deploy.yml"/>
<File Path=".github/workflows/pack-nightly.yml"/>
<File Path=".github/workflows/pack.yml"/>
<File Path=".github/workflows/publish.yml"/>
<File Path=".github/workflows/release-tag.yml"/>
</Folder>
<Folder Name="/Solution Items/Demo/">
<File Path="demo/Directory.Packages.props"/>
<File Path="demo/global.json"/>
</Folder>
<Folder Name="/Solution Items/Package/">
<File Path="src/Directory.Packages.props"/>
<File Path="src/Directory.Build.props"/>
</Folder>
<Project Path="src/Semi.Avalonia.ColorPicker/Semi.Avalonia.ColorPicker.csproj"/>
<Project Path="src/Semi.Avalonia.DataGrid/Semi.Avalonia.DataGrid.csproj"/>
<Project Path="src/Semi.Avalonia.TreeDataGrid/Semi.Avalonia.TreeDataGrid.csproj"/>
<Project Path="src/Semi.Avalonia/Semi.Avalonia.csproj"/>
</Solution>

View File

@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.3.0</AvaloniaVersion>
<DataGridVersion>11.3.0</DataGridVersion>
<CommunityToolkitVersion>8.4.0</CommunityToolkitVersion>
</PropertyGroup>
</Project>

View File

@@ -1,27 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0-preview2</AvaloniaVersion>
<DataGridVersion>11.3.10</DataGridVersion>
<SkiaSharpVersion>3.119.1</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<!-- <PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />-->
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.3.1"/>
</ItemGroup>
</Project>

View File

@@ -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) }]
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -1,6 +1,5 @@
using Android.App; using Android.App;
using Android.Content.PM; using Android.Content.PM;
using Avalonia;
using Avalonia.Android; using Avalonia.Android;
namespace Semi.Avalonia.Demo.Android; namespace Semi.Avalonia.Demo.Android;
@@ -12,11 +11,6 @@ namespace Semi.Avalonia.Demo.Android;
MainLauncher = true, MainLauncher = true,
LaunchMode = LaunchMode.SingleTop, LaunchMode = LaunchMode.SingleTop,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity public class MainActivity : AvaloniaMainActivity<App>
{ {
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.WithSourceHanSansCNFont();
}
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net10.0-android</TargetFramework> <TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId> <ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId>
@@ -14,13 +14,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/> <AndroidResource Include="Icon.png">
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" /> <Link>Resources\drawable\Icon.png</Link>
</AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Android"/> <PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen"/> <PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -4,7 +4,6 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
<!-- Uncomment below to enable Native AOT compilation--> <!-- Uncomment below to enable Native AOT compilation-->
<!--<PublishAot>true</PublishAot>--> <!--<PublishAot>true</PublishAot>-->
</PropertyGroup> </PropertyGroup>
@@ -23,7 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Desktop"/> <PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -4,7 +4,6 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
<!-- Uncomment below to enable Native AOT compilation--> <!-- Uncomment below to enable Native AOT compilation-->
<!--<PublishAot>true</PublishAot>--> <!--<PublishAot>true</PublishAot>-->
</PropertyGroup> </PropertyGroup>
@@ -23,8 +22,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Desktop"/> <PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.LinuxFramebuffer"/> <PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,19 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.WebAssembly"> <Project Sdk="Microsoft.NET.Sdk.WebAssembly">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0-browser</TargetFramework> <TargetFramework>net8.0-browser</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" /> <AvaloniaResource Include="Assets\**"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Browser"/> <PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)"/>
<PackageReference Include="SkiaSharp"/>
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,17 +1,17 @@
<Application <Application
Name="Semi Avalonia Demo"
x:Class="Semi.Avalonia.Demo.App" x:Class="Semi.Avalonia.Demo.App"
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"
x:CompileBindings="True"
x:DataType="viewModels:ApplicationViewModel"
xmlns:semi="https://irihi.tech/semi" xmlns:semi="https://irihi.tech/semi"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels">
x:DataType="vm:ApplicationViewModel">
<Application.Styles> <Application.Styles>
<semi:SemiTheme Locale="zh-CN" /> <semi:SemiTheme Locale="zh-CN" />
<semi:SemiPopupAnimations /> <semi:SemiPopupAnimations />
<semi:ColorPickerSemiTheme /> <semi:ColorPickerSemiTheme />
<!-- <semi:DataGridSemiTheme /> --> <semi:DataGridSemiTheme />
<!-- <semi:TreeDataGridSemiTheme /> --> <semi:TreeDataGridSemiTheme />
</Application.Styles> </Application.Styles>
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
@@ -20,30 +20,12 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem
Header="About Us"
Command="{Binding JumpToCommand}"
CommandParameter="{Binding $self.Header}" />
</NativeMenu>
</NativeMenu.Menu>
<TrayIcon.Icons> <TrayIcon.Icons>
<TrayIcons> <TrayIcons>
<TrayIcon <TrayIcon Icon="/Assets/irihi.ico" MacOSProperties.IsTemplateIcon="true" ToolTipText="Semi Avalonia Demo">
Icon="{OnPlatform Default=/Assets/irihi.ico, macOS=/Assets/irihi2.ico}"
MacOSProperties.IsTemplateIcon="true"
Command="{Binding ActivateCommand}"
ToolTipText="Semi Avalonia Demo">
<TrayIcon.Menu> <TrayIcon.Menu>
<NativeMenu> <NativeMenu>
<NativeMenuItem <NativeMenuItem Header="Exit" Command="{Binding ExitCommand}" />
Header="About Us"
Command="{Binding JumpToCommand}"
CommandParameter="{Binding $self.Header}" />
<NativeMenuItem
Header="Exit"
Command="{Binding ExitCommand}" />
</NativeMenu> </NativeMenu>
</TrayIcon.Menu> </TrayIcon.Menu>
</TrayIcon> </TrayIcon>

View File

@@ -22,7 +22,7 @@ public partial class App : Application
case IClassicDesktopStyleApplicationLifetime desktop: case IClassicDesktopStyleApplicationLifetime desktop:
// Line below is needed to remove Avalonia data validation. // Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT // Without this line you will get duplicate validations from both Avalonia and CT
// BindingPlugins.DataValidators.RemoveAt(0); BindingPlugins.DataValidators.RemoveAt(0);
desktop.MainWindow = new MainWindow(); desktop.MainWindow = new MainWindow();
break; break;
case ISingleViewApplicationLifetime singleView: case ISingleViewApplicationLifetime singleView:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

View File

@@ -79,32 +79,6 @@ public static class ColorTokens
new("SemiColorDangerLightActive", "Danger Light Active") new("SemiColorDangerLightActive", "Danger Light Active")
]; ];
public static IReadOnlyList<Tuple<string, string>> AIGeneralTokens { get; } =
[
new("SemiColorAIGeneral", "AI General"),
new("SemiColorAIGeneralPointerover", "AI General Pointerover"),
new("SemiColorAIGeneralActive", "AI General Active"),
new("SemiColorAIGeneralDisabled", "AI General Disabled")
];
public static IReadOnlyList<Tuple<string, string>> AIPurpleTokens { get; } =
[
new("SemiColorAIPurple", "AI Purple"),
new("SemiColorAIPurplePointerover", "AI Purple Pointerover"),
new("SemiColorAIPurpleActive", "AI Purple Active"),
new("SemiColorAIPurpleDisabled", "AI Purple Disabled")
];
public static IReadOnlyList<Tuple<string, string>> AIBackgroundTokens { get; } =
[
new("SemiColorAIBackgroundBottom", "AI Bottom Background"),
new("SemiColorAIBackgroundBottomPointerover", "AI Bottom Background Pointerover"),
new("SemiColorAIBackgroundBottomActive", "AI Bottom Background Active"),
new("SemiColorAIBackgroundTop", "AI Top Background"),
new("SemiColorAIBackgroundTopPointerover", "AI Top Background Pointerover"),
new("SemiColorAIBackgroundTopActive", "AI Top Background Active"),
];
public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } = public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } =
[ [
new("SemiColorText0", "Text 0"), new("SemiColorText0", "Text 0"),

View File

@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input.Platform;
using Avalonia.Media; using Avalonia.Media;
using Semi.Avalonia.Demo.Converters; using Semi.Avalonia.Demo.Converters;
@@ -93,12 +92,6 @@ public class ColorDetailControl : TemplatedControl
Hex2 = hex2 as string; Hex2 = hex2 as string;
OpacityNumber = brush.Opacity.ToString(CultureInfo.InvariantCulture); OpacityNumber = brush.Opacity.ToString(CultureInfo.InvariantCulture);
} }
else
{
Hex = null;
Hex2 = null;
OpacityNumber = null;
}
} }
public async Task Copy(object o) public async Task Copy(object o)

View File

@@ -8,6 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
x:DataType="vm:AboutUsViewModel" x:DataType="vm:AboutUsViewModel"
x:CompileBindings="True"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">

View File

@@ -7,6 +7,7 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="False"
x:DataType="vm:AutoCompleteBoxDemoViewModel" x:DataType="vm:AutoCompleteBoxDemoViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<Design.DataContext> <Design.DataContext>
@@ -28,59 +29,59 @@
</StackPanel.Styles> </StackPanel.Styles>
<AutoCompleteBox <AutoCompleteBox
PlaceholderText="Please select a State" Watermark="Please select a State"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name}" />
<AutoCompleteBox <AutoCompleteBox
Classes="Large" Classes="Large"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Classes="Small" Classes="Small"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Classes="Bordered" Classes="Bordered"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
IsEnabled="False" IsEnabled="False"
PlaceholderText="Disabled" Watermark="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
InnerLeftContent="https://" InnerLeftContent="https://"
InnerRightContent=".com" InnerRightContent=".com"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Large" Classes="Large"
PlaceholderText="Large" Watermark="Large"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
PlaceholderText="Default" Watermark="Default"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Small" Classes="Small"
PlaceholderText="Small" Watermark="Small"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
IsEnabled="False" IsEnabled="False"
PlaceholderText="Disabled" Watermark="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Bordered" Classes="Bordered"
PlaceholderText="Bordered" Watermark="Bordered"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Bordered" Classes="Bordered"
IsEnabled="False" IsEnabled="False"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{ReflectionBinding Name}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@@ -6,369 +6,174 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"> mc:Ignorable="d">
<ScrollViewer> <ScrollViewer>
<StackPanel HorizontalAlignment="Left" Spacing="8"> <StackPanel HorizontalAlignment="Left" Spacing="20">
<StackPanel.Styles> <StackPanel.Styles>
<Style Selector="SplitButton,DropDownButton,ToggleSplitButton"> <Style Selector="SplitButton">
<Setter Property="Button.Flyout"> <Setter Property="Flyout">
<MenuFlyout> <MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuItem Header="Submit All" />
<MenuItem Header="Submit Updated" />
</MenuFlyout>
</Setter>
</Style>
<Style Selector="DropDownButton">
<Setter Property="Flyout">
<MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuItem Header="Submit All" />
<MenuItem Header="Submit Updated" />
</MenuFlyout>
</Setter>
</Style>
<Style Selector="ToggleSplitButton">
<Setter Property="Flyout">
<MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuItem Header="Submit All" /> <MenuItem Header="Submit All" />
<MenuItem Header="Submit Updated" /> <MenuItem Header="Submit Updated" />
</MenuFlyout> </MenuFlyout>
</Setter> </Setter>
</Style> </Style>
</StackPanel.Styles> </StackPanel.Styles>
<HeaderedContentControl
Theme="{StaticResource GroupBox}">
<HeaderedContentControl.Header>
<StackPanel Spacing="8">
<TextBlock Text="Button/RepeatButton Theme" />
<WrapPanel ItemSpacing="4">
<TextBlock Text="Theme:" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue Solid" Content="Light" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue Solid" Content="Solid" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue Solid" Content="Outline" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue Solid" Content="Borderless" />
</WrapPanel>
<WrapPanel ItemSpacing="4">
<TextBlock Text="Classes:" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Primary" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Secondary" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Tertiary" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Success" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Warning" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Danger" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl.Header>
<StackPanel HorizontalAlignment="Left" Spacing="16">
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Default" />
<Button Content="Primary" Classes="Primary" />
<Button Content="Secondary" Classes="Secondary" />
<Button Content="Tertiary" Classes="Tertiary" />
<Button Content="Success" Classes="Success" />
<Button Content="Warning" Classes="Warning" />
<Button Content="Danger" Classes="Danger" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Default" Theme="{StaticResource SolidButton}" />
<Button Content="Primary" Classes="Primary" Theme="{StaticResource SolidButton}" />
<Button Content="Secondary" Classes="Secondary" Theme="{StaticResource SolidButton}" />
<Button Content="Tertiary" Classes="Tertiary" Theme="{StaticResource SolidButton}" />
<Button Content="Success" Classes="Success" Theme="{StaticResource SolidButton}" />
<Button Content="Warning" Classes="Warning" Theme="{StaticResource SolidButton}" />
<Button Content="Danger" Classes="Danger" Theme="{StaticResource SolidButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Default" Theme="{StaticResource OutlineButton}" />
<Button Content="Primary" Classes="Primary" Theme="{StaticResource OutlineButton}" />
<Button Content="Secondary" Classes="Secondary" Theme="{StaticResource OutlineButton}" />
<Button Content="Tertiary" Classes="Tertiary" Theme="{StaticResource OutlineButton}" />
<Button Content="Success" Classes="Success" Theme="{StaticResource OutlineButton}" />
<Button Content="Warning" Classes="Warning" Theme="{StaticResource OutlineButton}" />
<Button Content="Danger" Classes="Danger" Theme="{StaticResource OutlineButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Default" Theme="{StaticResource BorderlessButton}" />
<Button Content="Primary" Classes="Primary" Theme="{StaticResource BorderlessButton}" />
<Button Content="Secondary" Classes="Secondary" Theme="{StaticResource BorderlessButton}" />
<Button Content="Tertiary" Classes="Tertiary" Theme="{StaticResource BorderlessButton}" />
<Button Content="Success" Classes="Success" Theme="{StaticResource BorderlessButton}" />
<Button Content="Warning" Classes="Warning" Theme="{StaticResource BorderlessButton}" />
<Button Content="Danger" Classes="Danger" Theme="{StaticResource BorderlessButton}" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl <TextBlock>Light (Default)</TextBlock>
Theme="{StaticResource GroupBox}" <StackPanel Orientation="Horizontal" Spacing="20">
Header="Prohibited Status"> <Button Classes="Primary">Primary</Button>
<WrapPanel ItemSpacing="16" LineSpacing="16"> <Button Classes="Secondary">Secondary</Button>
<Button Content="Light" IsEnabled="False" /> <Button Classes="Tertiary">Tertiary</Button>
<Button Content="Solid" IsEnabled="False" Theme="{StaticResource SolidButton}" /> <Button Classes="Success">Success</Button>
<Button Content="Outline" IsEnabled="False" Theme="{StaticResource OutlineButton}" /> <Button Classes="Warning">Warning</Button>
<Button Content="Borderless" IsEnabled="False" Theme="{StaticResource BorderlessButton}" /> <Button Classes="Danger">Danger</Button>
</WrapPanel> <Button Classes="Danger" IsEnabled="False">Disabled</Button>
</HeaderedContentControl> </StackPanel>
<TextBlock>Solid</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource SolidButton}">Primary</Button>
<Button Classes="Secondary" Theme="{DynamicResource SolidButton}">Secondary</Button>
<Button Classes="Tertiary" Theme="{DynamicResource SolidButton}">Tertiary</Button>
<Button Classes="Success" Theme="{DynamicResource SolidButton}">Success</Button>
<Button Classes="Warning" Theme="{DynamicResource SolidButton}">Warning</Button>
<Button Classes="Danger" Theme="{DynamicResource SolidButton}">Danger</Button>
<Button
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource SolidButton}">
Disabled
</Button>
</StackPanel>
<TextBlock>Outline</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource OutlineButton}">Primary</Button>
<Button Classes="Secondary" Theme="{DynamicResource OutlineButton}">Secondary</Button>
<Button Classes="Tertiary" Theme="{DynamicResource OutlineButton}">Tertiary</Button>
<Button Classes="Success" Theme="{DynamicResource OutlineButton}">Success</Button>
<Button Classes="Warning" Theme="{DynamicResource OutlineButton}">Warning</Button>
<Button Classes="Danger" Theme="{DynamicResource OutlineButton}">Danger</Button>
<Button Classes="Danger" Theme="{DynamicResource OutlineButton}" IsEnabled="False">Disabled</Button>
</StackPanel>
<TextBlock>Borderless</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource BorderlessButton}">Primary</Button>
<Button Classes="Secondary" Theme="{DynamicResource BorderlessButton}">Secondary</Button>
<Button Classes="Tertiary" Theme="{DynamicResource BorderlessButton}">Tertiary</Button>
<Button Classes="Success" Theme="{DynamicResource BorderlessButton}">Success</Button>
<Button Classes="Warning" Theme="{DynamicResource BorderlessButton}">Warning</Button>
<Button Classes="Danger" Theme="{DynamicResource BorderlessButton}">Danger</Button>
<Button
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource BorderlessButton}">
Disabled
</Button>
</StackPanel>
<TextBlock>Disabled</TextBlock>
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<Button IsEnabled="False">Light</Button>
<Button IsEnabled="False" Theme="{DynamicResource SolidButton}">Solid</Button>
<Button IsEnabled="False" Theme="{DynamicResource OutlineButton}">Outline</Button>
<Button IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Borderless</Button>
</StackPanel>
<TextBlock>Size Classes</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary Small">Small</Button>
<Button Classes="Primary">Default</Button>
<Button Classes="Primary Large">Large</Button>
</StackPanel>
<HeaderedContentControl <TextBlock>DropDownButton</TextBlock>
Theme="{StaticResource GroupBox}"> <StackPanel Orientation="Horizontal" Spacing="8">
<HeaderedContentControl.Header> <DropDownButton Content="Primary" />
<StackPanel Spacing="8"> <DropDownButton Classes="Secondary" Content="Secondary" />
<WrapPanel ItemSpacing="4"> <DropDownButton Classes="Tertiary" Content="Tertiary" />
<TextBlock Text="Size Classes:" /> <DropDownButton Classes="Success" Content="Success" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Large" /> <DropDownButton Classes="Warning" Content="Warning" />
<Label Theme="{StaticResource TagLabel}" Classes="Blue" Content="Small" /> <DropDownButton Classes="Danger" Content="Danger" />
</WrapPanel> <DropDownButton
</StackPanel> Classes="Danger"
</HeaderedContentControl.Header> Content="Disabled"
<WrapPanel ItemSpacing="16" LineSpacing="16"> IsEnabled="False" />
<Button Content="Large" Classes="Large" /> </StackPanel>
<Button Content="Default" /> <StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Small" Classes="Small" /> <DropDownButton Content="Default" Classes="Success" />
</WrapPanel> <DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" />
</HeaderedContentControl> <DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" />
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" />
<DropDownButton Content="Default" Classes="Success" IsEnabled="False" />
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" IsEnabled="False" />
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" IsEnabled="False" />
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<DropDownButton Classes="Small" Content="Small" />
<DropDownButton Content="Default" />
<DropDownButton Classes="Large" Content="Large" />
</StackPanel>
<HeaderedContentControl <TextBlock>SplitButton</TextBlock>
Theme="{StaticResource GroupBox}"> <StackPanel Orientation="Horizontal" Spacing="8">
<HeaderedContentControl.Header> <SplitButton Content="Primary" />
<StackPanel Spacing="8"> <SplitButton Classes="Secondary" Content="Secondary" />
<TextBlock Text="AI style - Colorful Button" /> <SplitButton Classes="Tertiary" Content="Tertiary" />
<WrapPanel ItemSpacing="4"> <SplitButton Classes="Success" Content="Success" />
<TextBlock Text="Theme:" /> <SplitButton Classes="Warning" Content="Warning" />
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient Solid" Content="Light" /> <SplitButton Classes="Danger" Content="Danger" />
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient Solid" Content="Solid" /> <SplitButton Classes="Danger" Content="Disabled" IsEnabled="False" />
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient Solid" Content="Outline" /> </StackPanel>
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient Solid" Content="Borderless" /> <StackPanel Orientation="Horizontal" Spacing="8">
</WrapPanel> <SplitButton Content="Default" Classes="Success" />
<WrapPanel ItemSpacing="4"> <SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" />
<TextBlock Text="Classes:" /> <SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" />
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient" Content="Colorful Primary" /> <SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" />
<Label Theme="{StaticResource TagLabel}" Classes="Colorful Gradient" Content="Colorful Tertiary" /> <SplitButton Content="Default" Classes="Success" IsEnabled="False" />
</WrapPanel> <SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" IsEnabled="False" />
</StackPanel> <SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" IsEnabled="False" />
</HeaderedContentControl.Header> <SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" IsEnabled="False" />
<StackPanel HorizontalAlignment="Left" Spacing="16"> </StackPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16"> <StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Primary" Classes="Colorful Primary" /> <SplitButton Classes="Small" Content="Small" />
<Button Content="Tertiary" Classes="Colorful Tertiary" /> <SplitButton Content="Default" />
<Button Content="Disabled" Classes="Colorful Primary" IsEnabled="False" /> <SplitButton Classes="Large" Content="Large" />
</WrapPanel> </StackPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Primary" Classes="Colorful Primary" Theme="{StaticResource SolidButton}" />
<Button Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource SolidButton}" />
<Button Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource SolidButton}" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Primary" Classes="Colorful Primary" Theme="{StaticResource OutlineButton}" />
<Button Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource OutlineButton}" />
<Button Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource OutlineButton}" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<Button Content="Primary" Classes="Colorful Primary" Theme="{StaticResource BorderlessButton}" />
<Button Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource BorderlessButton}" />
<Button Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource BorderlessButton}" IsEnabled="False" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl <TextBlock>ToggleSplitButton</TextBlock>
Theme="{StaticResource GroupBox}" Header="DropDownButton"> <StackPanel Orientation="Horizontal" Spacing="8">
<StackPanel HorizontalAlignment="Left" Spacing="16"> <ToggleSplitButton Content="Primary" />
<WrapPanel ItemSpacing="16" LineSpacing="16"> <ToggleSplitButton Classes="Secondary" Content="Secondary" />
<DropDownButton Content="Default" /> <ToggleSplitButton Classes="Tertiary" Content="Tertiary" />
<DropDownButton Content="Primary" Classes="Primary" /> <ToggleSplitButton Classes="Success" Content="Success" />
<DropDownButton Content="Secondary" Classes="Secondary" /> <ToggleSplitButton Classes="Warning" Content="Warning" />
<DropDownButton Content="Tertiary" Classes="Tertiary" /> <ToggleSplitButton Classes="Danger" Content="Danger" />
<DropDownButton Content="Success" Classes="Success" /> <ToggleSplitButton Classes="Danger" Content="Disabled" IsEnabled="False" />
<DropDownButton Content="Warning" Classes="Warning" /> </StackPanel>
<DropDownButton Content="Danger" Classes="Danger" /> <StackPanel Orientation="Horizontal" Spacing="8">
</WrapPanel> <ToggleSplitButton Content="Default" Classes="Success" />
<WrapPanel ItemSpacing="16" LineSpacing="16"> <ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" />
<DropDownButton Content="Default" Theme="{StaticResource SolidDropDownButton}" /> <ToggleSplitButton Content="Default" Classes="Success" IsEnabled="False" />
<DropDownButton Content="Primary" Classes="Primary" Theme="{StaticResource SolidDropDownButton}" /> <ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
<DropDownButton Content="Secondary" Classes="Secondary" Theme="{StaticResource SolidDropDownButton}" /> </StackPanel>
<DropDownButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource SolidDropDownButton}" /> <StackPanel Orientation="Horizontal" Spacing="8">
<DropDownButton Content="Success" Classes="Success" Theme="{StaticResource SolidDropDownButton}" /> <ToggleSplitButton Classes="Small" Content="Small" />
<DropDownButton Content="Warning" Classes="Warning" Theme="{StaticResource SolidDropDownButton}" /> <ToggleSplitButton Content="Default" />
<DropDownButton Content="Danger" Classes="Danger" Theme="{StaticResource SolidDropDownButton}" /> <ToggleSplitButton Classes="Large" Content="Large" />
</WrapPanel> </StackPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Default" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Primary" Classes="Primary" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Secondary" Classes="Secondary" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Success" Classes="Success" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Warning" Classes="Warning" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Danger" Classes="Danger" Theme="{StaticResource OutlineDropDownButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Default" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Primary" Classes="Primary" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Secondary" Classes="Secondary" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Success" Classes="Success" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Warning" Classes="Warning" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Danger" Classes="Danger" Theme="{StaticResource BorderlessDropDownButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Light" IsEnabled="False" />
<DropDownButton Content="Solid" IsEnabled="False" Theme="{StaticResource SolidDropDownButton}" />
<DropDownButton Content="Outline" IsEnabled="False" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Borderless" IsEnabled="False" Theme="{StaticResource BorderlessDropDownButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Large" Classes="Large" />
<DropDownButton Content="Default" />
<DropDownButton Content="Small" Classes="Small" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Primary" Classes="Colorful Primary" />
<DropDownButton Content="Tertiary" Classes="Colorful Tertiary" />
<DropDownButton Content="Disabled" Classes="Colorful Primary" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Primary" Classes="Colorful Primary" Theme="{StaticResource SolidDropDownButton}" />
<DropDownButton Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource SolidDropDownButton}" />
<DropDownButton Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource SolidDropDownButton}" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Primary" Classes="Colorful Primary" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource OutlineDropDownButton}" />
<DropDownButton Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource OutlineDropDownButton}" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<DropDownButton Content="Primary" Classes="Colorful Primary" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Tertiary" Classes="Colorful Tertiary" Theme="{StaticResource BorderlessDropDownButton}" />
<DropDownButton Content="Disabled" Classes="Colorful Primary" Theme="{StaticResource BorderlessDropDownButton}" IsEnabled="False" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl
Theme="{StaticResource GroupBox}" Header="SplitButton">
<StackPanel HorizontalAlignment="Left" Spacing="16">
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Default" />
<SplitButton Content="Primary" Classes="Primary" />
<SplitButton Content="Secondary" Classes="Secondary" />
<SplitButton Content="Tertiary" Classes="Tertiary" />
<SplitButton Content="Success" Classes="Success" />
<SplitButton Content="Warning" Classes="Warning" />
<SplitButton Content="Danger" Classes="Danger" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Default" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Primary" Classes="Primary" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Secondary" Classes="Secondary" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Success" Classes="Success" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Warning" Classes="Warning" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Danger" Classes="Danger" Theme="{StaticResource SolidSplitButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Default" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Primary" Classes="Primary" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Secondary" Classes="Secondary" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Success" Classes="Success" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Warning" Classes="Warning" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Danger" Classes="Danger" Theme="{StaticResource OutlineSplitButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Default" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Primary" Classes="Primary" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Secondary" Classes="Secondary" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Tertiary" Classes="Tertiary" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Success" Classes="Success" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Warning" Classes="Warning" Theme="{StaticResource BorderlessSplitButton}" />
<SplitButton Content="Danger" Classes="Danger" Theme="{StaticResource BorderlessSplitButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Light" IsEnabled="False" />
<SplitButton Content="Solid" IsEnabled="False" Theme="{StaticResource SolidSplitButton}" />
<SplitButton Content="Outline" IsEnabled="False" Theme="{StaticResource OutlineSplitButton}" />
<SplitButton Content="Borderless" IsEnabled="False" Theme="{StaticResource BorderlessSplitButton}" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<SplitButton Content="Large" Classes="Large" />
<SplitButton Content="Default" />
<SplitButton Content="Small" Classes="Small" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl
Theme="{StaticResource GroupBox}"
Header="ToggleSplitButton">
<StackPanel HorizontalAlignment="Left" Spacing="24">
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleSplitButton Content="Default" />
<ToggleSplitButton Classes="Primary" Content="Primary" />
<ToggleSplitButton Classes="Secondary" Content="Secondary" />
<ToggleSplitButton Classes="Tertiary" Content="Tertiary" />
<ToggleSplitButton Classes="Success" Content="Success" />
<ToggleSplitButton Classes="Warning" Content="Warning" />
<ToggleSplitButton Classes="Danger" Content="Danger" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleSplitButton Content="Default" IsChecked="True" />
<ToggleSplitButton Classes="Primary" Content="Primary" IsChecked="True" />
<ToggleSplitButton Classes="Secondary" Content="Secondary" IsChecked="True" />
<ToggleSplitButton Classes="Tertiary" Content="Tertiary" IsChecked="True" />
<ToggleSplitButton Classes="Success" Content="Success" IsChecked="True" />
<ToggleSplitButton Classes="Warning" Content="Warning" IsChecked="True" />
<ToggleSplitButton Classes="Danger" Content="Danger" IsChecked="True" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleSplitButton Content="Unchecked" Classes="Success" IsEnabled="False" />
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleSplitButton Content="Large" Classes="Large" />
<ToggleSplitButton Content="Default" />
<ToggleSplitButton Content="Small" Classes="Small" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl
Theme="{StaticResource GroupBox}" Header="ToggleButton">
<StackPanel HorizontalAlignment="Left" Spacing="16">
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Default" />
<ToggleButton Content="Primary" Classes="Primary" />
<ToggleButton Content="Secondary" Classes="Secondary" />
<ToggleButton Content="Tertiary" Classes="Tertiary" />
<ToggleButton Content="Success" Classes="Success" />
<ToggleButton Content="Warning" Classes="Warning" />
<ToggleButton Content="Danger" Classes="Danger" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Default" IsChecked="True" />
<ToggleButton Content="Primary" Classes="Primary" IsChecked="True" />
<ToggleButton Content="Secondary" Classes="Secondary" IsChecked="True" />
<ToggleButton Content="Tertiary" Classes="Tertiary" IsChecked="True" />
<ToggleButton Content="Success" Classes="Success" IsChecked="True" />
<ToggleButton Content="Warning" Classes="Warning" IsChecked="True" />
<ToggleButton Content="Danger" Classes="Danger" IsChecked="True" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Default" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Primary" Classes="Primary" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Secondary" Classes="Secondary" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Tertiary" Classes="Tertiary" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Success" Classes="Success" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Warning" Classes="Warning" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Danger" Classes="Danger" IsChecked="{x:Null}" IsThreeState="True" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Unchecked" IsEnabled="False" />
<ToggleButton Content="Checked" IsEnabled="False" IsChecked="True" />
<ToggleButton Content="Indeterminate" IsEnabled="False" IsChecked="{x:Null}" IsThreeState="True" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Large" Classes="Large" />
<ToggleButton Content="Default" />
<ToggleButton Content="Small" Classes="Small" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Primary" Classes="Colorful Primary" />
<ToggleButton Content="Tertiary" Classes="Colorful Tertiary" />
<ToggleButton Content="Disabled" Classes="Colorful Primary" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Primary" Classes="Colorful Primary" IsChecked="True" />
<ToggleButton Content="Tertiary" Classes="Colorful Tertiary" IsChecked="True" />
<ToggleButton Content="Disabled" Classes="Colorful Primary" IsChecked="True" IsEnabled="False" />
</WrapPanel>
<WrapPanel ItemSpacing="16" LineSpacing="16">
<ToggleButton Content="Primary" Classes="Colorful Primary" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Tertiary" Classes="Colorful Tertiary" IsChecked="{x:Null}" IsThreeState="True" />
<ToggleButton Content="Disabled" Classes="Colorful Primary" IsChecked="{x:Null}" IsThreeState="True" IsEnabled="False" />
</WrapPanel>
</StackPanel>
</HeaderedContentControl>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</UserControl> </UserControl>

View File

@@ -8,10 +8,6 @@
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<StackPanel HorizontalAlignment="Left" Spacing="20"> <StackPanel HorizontalAlignment="Left" Spacing="20">
<StackPanel Orientation="Horizontal">
<ToggleSwitch Name="showSpinCheck" IsChecked="True" Content="Show Button Spinner" />
<ToggleSwitch Name="allowSpinCheck" IsChecked="True" Content="Allow Spin" />
</StackPanel>
<ButtonSpinner <ButtonSpinner
Height="30" Height="30"
AllowSpin="{Binding #allowSpinCheck.IsChecked}" AllowSpin="{Binding #allowSpinCheck.IsChecked}"

View File

@@ -7,51 +7,46 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="800" d:DesignHeight="800"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d" mc:Ignorable="d">
x:DataType="vm:ComboBoxDemoViewModel">
<Design.DataContext> <Design.DataContext>
<vm:ComboBoxDemoViewModel /> <vm:ComboBoxDemoViewModel />
</Design.DataContext> </Design.DataContext>
<ScrollViewer> <StackPanel Spacing="20">
<StackPanel Spacing="20"> <StackPanel.Styles>
<StackPanel.Styles> <Style Selector="ComboBox">
<Style Selector="ComboBox"> <Setter Property="Width" Value="300" />
<Setter Property="Width" Value="300" /> <Setter Property="ItemsSource" Value="{Binding Items}" />
<Setter Property="ItemsSource" Value="{Binding Items}" /> </Style>
</Style> </StackPanel.Styles>
</StackPanel.Styles>
<ComboBox /> <ComboBox />
<ComboBox Classes="ClearButton" /> <ComboBox Classes="ClearButton" />
<ComboBox PlaceholderText="Please Select" /> <ComboBox PlaceholderText="Please Select" />
<ComboBox IsEnabled="False" /> <ComboBox IsEnabled="False" />
<ComboBox Classes="Large" IsEnabled="False" /> <ComboBox Classes="Large" IsEnabled="False" />
<ComboBox Classes="Small" /> <ComboBox Classes="Small" />
<ComboBox Classes="Bordered" /> <ComboBox Classes="Bordered" />
<ComboBox Classes="Bordered" IsEnabled="False" /> <ComboBox Classes="Bordered" IsEnabled="False" />
<ComboBox> <ComboBox>
<ComboBox.SelectionBoxItemTemplate> <ComboBox.SelectionBoxItemTemplate>
<DataTemplate DataType="x:String"> <DataTemplate DataType="x:String">
<ContentControl BorderThickness="1" <ContentControl BorderThickness="1"
BorderBrush="Gold" BorderBrush="Gold"
Content="{Binding}" /> Content="{Binding}" />
</DataTemplate> </DataTemplate>
</ComboBox.SelectionBoxItemTemplate> </ComboBox.SelectionBoxItemTemplate>
</ComboBox> </ComboBox>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<ComboBox Width="100" Classes="Large" PlaceholderText="Large" /> <ComboBox Width="100" Classes="Large" PlaceholderText="Large" />
<ComboBox Width="100" PlaceholderText="Default" /> <ComboBox Width="100" PlaceholderText="Default" />
<ComboBox Width="100" Classes="Small" PlaceholderText="Small" /> <ComboBox Width="100" Classes="Small" PlaceholderText="Small" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ComboBox Width="100" IsEnabled="False" PlaceholderText="Disabled" />
<ComboBox Width="100" Classes="Bordered" PlaceholderText="Bordered" />
<ComboBox Width="100" Classes="Bordered" IsEnabled="False" />
</StackPanel>
<ToggleSwitch Name="toggle" IsChecked="True" Content="IsEditable" />
<ComboBox IsEditable="{Binding #toggle.IsChecked}" />
</StackPanel> </StackPanel>
</ScrollViewer>
<StackPanel Orientation="Horizontal">
<ComboBox Width="100" IsEnabled="False" PlaceholderText="Disabled" />
<ComboBox Width="100" Classes="Bordered" PlaceholderText="Bordered" />
<ComboBox Width="100" Classes="Bordered" IsEnabled="False" />
</StackPanel>
</StackPanel>
</UserControl> </UserControl>

View File

@@ -0,0 +1,180 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.DataGridDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:DataGridDemoViewModel"
mc:Ignorable="d">
<TabControl>
<TabItem Header="DataGrid">
<Grid RowDefinitions="Auto, *">
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
<ToggleSwitch Content="Inset Content" Name="inset" />
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
</StackPanel>
<DataGrid Grid.Row="1"
Margin="8"
CanUserReorderColumns="True"
CanUserResizeColumns="True"
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
Classes.InsetContent="{Binding #inset.IsChecked}"
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
IsEnabled="{Binding #enable.IsChecked}"
ItemsSource="{Binding GridData1}">
<DataGrid.Columns>
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Title}"
Header="Title" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Artist}"
Header="Artist" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Album}"
Header="Album" />
<DataGridTemplateColumn Header="Duration" SortMemberPath="Duration">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{Binding Duration}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</TabItem>
<TabItem Header="Grouping">
<DataGrid
Margin="8"
CanUserReorderColumns="True"
CanUserResizeColumns="True"
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ItemsSource="{Binding GridData2}">
<DataGrid.Columns>
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Title}"
Header="Title" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Artist}"
Header="Artist" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:Song"
Binding="{Binding Album}"
Header="Album" />
<DataGridTemplateColumn
x:DataType="vm:Song"
Header="Duration"
SortMemberPath="Duration">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="vm:Song">
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{Binding Duration}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Name="EditableTab" Header="Editable">
<Grid Margin="8" RowDefinitions="Auto,*,Auto">
<StackPanel
Grid.Row="0"
Orientation="Horizontal"
Spacing="4">
<TextBlock VerticalAlignment="Center" Text="FontSize:" />
<Slider
Name="FontSizeSlider"
Width="100"
VerticalAlignment="Center"
Maximum="30"
Minimum="5"
Value="14" />
<CheckBox
Name="IsThreeStateCheckBox"
Content="IsThreeState"
IsChecked="False" />
</StackPanel>
<DataGrid
Grid.Row="1"
Margin="8"
ItemsSource="{Binding GridData3}">
<DataGrid.Columns>
<DataGridCheckBoxColumn
Width="2*"
Binding="{Binding IsSelected}"
Header="Select"
IsThreeState="{Binding #IsThreeStateCheckBox.IsChecked, Mode=OneWay}" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:SongViewModel"
Binding="{Binding Title}"
FontSize="{Binding #FontSizeSlider.Value, Mode=OneWay}"
Header="Title" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:SongViewModel"
Binding="{Binding Artist}"
Header="Artist" />
<DataGridTextColumn
Width="6*"
x:DataType="vm:SongViewModel"
Binding="{Binding Album}"
Header="Album" />
<DataGridTemplateColumn Width="2*" Header="Comments">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding CountOfComment}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<NumericUpDown
HorizontalAlignment="Stretch"
FormatString="N0"
Minimum="0"
Value="{Binding CountOfComment}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Button
Grid.Row="2"
Margin="12,0,12,12"
HorizontalAlignment="Right"
Command="{Binding AddCommand}"
Content="Add" />
</Grid>
</TabItem>
</TabControl>
</UserControl>

View File

@@ -0,0 +1,13 @@
using Avalonia.Controls;
using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages;
public partial class DataGridDemo : UserControl
{
public DataGridDemo()
{
InitializeComponent();
DataContext = new DataGridDemoViewModel();
}
}

View File

@@ -36,20 +36,10 @@
<HyperlinkButton HorizontalAlignment="Right" Content="更多" /> <HyperlinkButton HorizontalAlignment="Right" Content="更多" />
</Panel> </Panel>
</HeaderedContentControl.Header> </HeaderedContentControl.Header>
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" /> <HeaderedContentControl.Content>
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" />
</HeaderedContentControl.Content>
</HeaderedContentControl> </HeaderedContentControl>
<TextBlock>Real GroupBox</TextBlock>
<GroupBox
HorizontalAlignment="Left"
MaxWidth="360">
<HeaderedContentControl.Header>
<Panel>
<SelectableTextBlock Text="Semi Design" />
<HyperlinkButton HorizontalAlignment="Right" Content="更多" />
</Panel>
</HeaderedContentControl.Header>
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" />
</GroupBox>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</UserControl> </UserControl>

View File

@@ -0,0 +1,328 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:cvt="clr-namespace:Semi.Avalonia.Demo.Converters"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1450"
x:DataType="vm:HighContrastDemoViewModel"
x:CompileBindings="True"
x:Class="Semi.Avalonia.Demo.Pages.HighContrastDemo">
<Design.DataContext>
<vm:HighContrastDemoViewModel />
</Design.DataContext>
<SplitView
Name="splitView"
CompactPaneLength="50"
DisplayMode="CompactInline"
IsPaneOpen="{Binding #toggle.IsChecked, Mode=TwoWay}"
OpenPaneLength="300"
PanePlacement="Right">
<SplitView.Pane>
<StackPanel>
<ToggleSwitch
Name="toggle"
HorizontalAlignment="Right"
IsChecked="True"
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}" />
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
<Panel>
<TextBlock
IsVisible="{Binding SelectedColorResource, Converter={x:Static ObjectConverters.IsNull}}"
Text="Click on Color to Check Details"
TextWrapping="Wrap" />
<controls:ColorDetailControl
Background="{Binding SelectedColorResource.Brush}"
IsVisible="{Binding SelectedColorResource, Converter={x:Static ObjectConverters.IsNotNull}}"
ResourceKey="{Binding SelectedColorResource.ResourceKey}"
ResourceName="{Binding SelectedColorResource.ResourceKey}" />
</Panel>
</Border>
</StackPanel>
</SplitView.Pane>
<SplitView.Content>
<ScrollViewer>
<StackPanel Spacing="10">
<TextBlock Text="Theme Preview" FontWeight="SemiBold" />
<ListBox
Theme="{StaticResource PureCardRadioGroupListBox}"
ItemsSource="{Binding ThemeVariants}"
SelectedItem="{Binding SelectedThemeVariant}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Left" Spacing="5" MinWidth="200">
<ThemeVariantScope RequestedThemeVariant="{Binding}">
<Border
Padding="5 25 5 5"
HorizontalAlignment="Left"
Background="{DynamicResource WindowColor}"
BorderBrush="{DynamicResource WindowTextColor}"
BorderThickness="1"
CornerRadius="3">
<StackPanel Spacing="10">
<StackPanel Orientation="Horizontal" Spacing="50">
<StackPanel Spacing="5">
<TextBlock
FontSize="50"
Text="Aa" />
<StackPanel Orientation="Horizontal" Spacing="3">
<StackPanel.Styles>
<Style Selector="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource WindowTextColor}" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="Width" Value="10" />
<Setter Property="Height" Value="{Binding $self.Width}" />
</Style>
</StackPanel.Styles>
<Border Background="{DynamicResource WindowColor}" />
<Border Background="{DynamicResource HotlightColor}" />
<Border Background="{DynamicResource GrayTextColor}" />
<Border Background="{DynamicResource HighlightTextColor}" />
<Border Background="{DynamicResource HighlightColor}" />
</StackPanel>
</StackPanel>
<Border
BorderThickness="1"
BorderBrush="{DynamicResource WindowTextColor}"
CornerRadius="3"
Padding="8">
<Panel>
<StackPanel Spacing="5">
<Border
Width="50"
Height="1"
Background="{DynamicResource WindowTextColor}" />
<Border
Height="1"
Background="{DynamicResource WindowTextColor}" />
<Border
Height="1"
Background="{DynamicResource WindowTextColor}" />
</StackPanel>
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Orientation="Horizontal"
Spacing="2">
<Border
Width="20"
Height="5"
Background="{DynamicResource HighlightColor}"
CornerRadius="1" />
<Border
Width="20"
Height="5"
BorderThickness="1"
BorderBrush="{DynamicResource ButtonTextColor}"
CornerRadius="1" />
</StackPanel>
</Panel>
</Border>
</StackPanel>
<Border
Height="1"
Background="{DynamicResource WindowTextColor}" />
</StackPanel>
</Border>
</ThemeVariantScope>
<TextBlock Text="{Binding}" FontWeight="SemiBold" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ThemeVariantScope
MinWidth="400"
RequestedThemeVariant="{Binding SelectedThemeVariant}">
<Border Padding="10" Background="{DynamicResource WindowColor}">
<StackPanel Spacing="16">
<StackPanel.Styles>
<Style Selector="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
<Style Selector="controls|ColorItemControl.ColorBlock">
<Setter Property="Width" Value="44" />
<Setter Property="Height" Value="{Binding $self.Width}" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource WindowTextColor}" />
<Setter Property="CornerRadius" Value="3" />
</Style>
</StackPanel.Styles>
<Panel>
<TextBlock
Foreground="{DynamicResource WindowTextColor}"
Text="Background" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[0]}"
Background="{DynamicResource WindowColor}" />
</Panel>
<Panel>
<TextBlock
Foreground="{DynamicResource WindowTextColor}"
Text="Text" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[1]}"
Background="{DynamicResource WindowTextColor}" />
</Panel>
<Panel>
<TextBlock
Foreground="{DynamicResource HotlightColor}"
TextDecorations="Underline"
Text="Hyperlink" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[2]}"
Background="{DynamicResource HotlightColor}" />
</Panel>
<Panel>
<TextBlock
Foreground="{DynamicResource GrayTextColor}"
Text="Inactive Text" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[3]}"
Background="{DynamicResource GrayTextColor}" />
</Panel>
<Panel>
<TextBlock
Foreground="{DynamicResource HighlightTextColor}"
Background="{DynamicResource HighlightColor}"
Text="Selected text" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="4">
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[4]}"
Background="{DynamicResource HighlightTextColor}" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[5]}"
Background="{DynamicResource HighlightColor}" />
</StackPanel>
</Panel>
<Panel>
<Border
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderBrush="{DynamicResource ButtonTextColor}"
Background="{DynamicResource ButtonFaceColor}"
BorderThickness="2"
CornerRadius="3">
<TextBlock
Foreground="{DynamicResource ButtonTextColor}"
Padding="16 6"
Text="Button text" />
</Border>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="4">
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[6]}"
Background="{DynamicResource ButtonTextColor}" />
<controls:ColorItemControl
Classes="ColorBlock"
DataContext="{Binding ColorResources[7]}"
Background="{DynamicResource ButtonFaceColor}" />
</StackPanel>
</Panel>
</StackPanel>
</Border>
</ThemeVariantScope>
<DataGrid
HorizontalAlignment="Left"
CanUserSortColumns="False"
AutoGenerateColumns="False"
ItemsSource="{Binding ColorResources}"
GridLinesVisibility="All"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
Padding="5">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Color">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<controls:ColorItemControl
Width="40"
Height="20"
CornerRadius="3"
Background="{Binding Brush}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<SelectableTextBlock
Margin="12 0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Hex">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<SelectableTextBlock
Margin="12 0"
VerticalAlignment="Center"
Text="{Binding Brush,
Converter={x:Static cvt:ColorConverter.ToHex},ConverterParameter={x:False}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Description">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<SelectableTextBlock
Margin="12 0"
VerticalAlignment="Center"
Text="{Binding Description}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Pair With">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<SelectableTextBlock
Margin="12 0"
VerticalAlignment="Center"
Text="{Binding PairWith}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:ColorResource">
<Button
Command="{Binding $parent[pages:HighContrastDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</ScrollViewer>
</SplitView.Content>
</SplitView>
</UserControl>

View File

@@ -0,0 +1,24 @@
using System.Threading.Tasks;
using Avalonia.Controls;
using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages;
public partial class HighContrastDemo : UserControl
{
public HighContrastDemo()
{
InitializeComponent();
this.DataContext = new HighContrastDemoViewModel();
}
public async Task Copy(object? o)
{
if (o is null) return;
var toplevel = TopLevel.GetTopLevel(this);
if (toplevel?.Clipboard is { } c)
{
await c.SetTextAsync(o.ToString());
}
}
}

View File

@@ -18,67 +18,78 @@
Text="{Binding SearchText}" Text="{Binding SearchText}"
Watermark="Input Icon Name" /> Watermark="Input Icon Name" />
<TabControl <TabControl Grid.Row="1">
Grid.Row="1" <TabItem Header="Filled Icons">
Theme="{StaticResource LineTabControl}" <ScrollViewer>
ItemsSource="{Binding IconTabs}"> <ItemsControl ItemsSource="{Binding FilteredFilledIcons}">
<TabControl.ItemTemplate> <ItemsControl.ItemsPanel>
<DataTemplate> <ItemsPanelTemplate>
<WrapPanel ItemSpacing="5"> <WrapPanel />
<TextBlock Text="{Binding Header}" /> </ItemsPanelTemplate>
<Label </ItemsControl.ItemsPanel>
Theme="{StaticResource TagLabel}" <ItemsControl.ItemTemplate>
Classes="Purple" <DataTemplate>
IsVisible="{Binding Header, <Button Theme="{DynamicResource OutlineButton}"
Converter={x:Static ObjectConverters.Equal}, Classes="Tertiary"
ConverterParameter='AI Icons'}" Padding="0"
Content="New" /> Margin="10"
</WrapPanel> Width="200"
</DataTemplate> Height="120"
</TabControl.ItemTemplate> Click="Button_Clicked">
<StackPanel Spacing="8">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
HorizontalAlignment="Center"
Classes="ExtraLarge"
Data="{Binding Geometry}" />
<TextBlock
HorizontalAlignment="Center"
FontSize="12"
FontWeight="Normal"
Text="{Binding ResourceKey}" />
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</TabItem>
<TabControl.ContentTemplate> <TabItem Header="Stroked Icons">
<DataTemplate DataType="vm:IconTab"> <ScrollViewer>
<ScrollViewer> <ItemsControl ItemsSource="{Binding FilteredStrokedIcons}">
<ItemsControl <ItemsControl.ItemsPanel>
Margin="0 10" <ItemsPanelTemplate>
ItemsSource="{Binding IconItems}"> <WrapPanel />
<ItemsControl.ItemsPanel> </ItemsPanelTemplate>
<ItemsPanelTemplate> </ItemsControl.ItemsPanel>
<WrapPanel <ItemsControl.ItemTemplate>
ItemWidth="200" <DataTemplate>
ItemHeight="120" <Button Theme="{DynamicResource OutlineButton}"
ItemSpacing="10" Classes="Tertiary"
LineSpacing="10" /> Padding="0"
</ItemsPanelTemplate> Margin="10"
</ItemsControl.ItemsPanel> Width="200"
<ItemsControl.ItemTemplate> Height="120"
<DataTemplate> Click="Button_Clicked">
<Button Theme="{DynamicResource OutlineButton}" <StackPanel Spacing="8">
Classes="Tertiary" <PathIcon
Padding="0" Theme="{DynamicResource InnerPathIcon}"
HorizontalAlignment="Stretch" HorizontalAlignment="Center"
VerticalAlignment="Stretch" Classes="ExtraLarge"
Click="Button_Clicked"> Data="{Binding Geometry}" />
<StackPanel Spacing="8"> <TextBlock
<PathIcon HorizontalAlignment="Center"
Theme="{DynamicResource InnerPathIcon}" FontSize="12"
HorizontalAlignment="Center" FontWeight="Normal"
Classes="ExtraLarge" Text="{Binding ResourceKey}" />
Data="{Binding Geometry}" /> </StackPanel>
<TextBlock </Button>
HorizontalAlignment="Center" </DataTemplate>
FontSize="12" </ItemsControl.ItemTemplate>
FontWeight="Normal" </ItemsControl>
Text="{Binding ResourceKey}" /> </ScrollViewer>
</StackPanel> </TabItem>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl> </TabControl>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -8,11 +8,14 @@
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<ScrollViewer> <ScrollViewer>
<StackPanel> <StackPanel HorizontalAlignment="Left" Spacing="20">
<StackPanel.Styles> <StackPanel.Styles>
<Style Selector="Grid > TextBlock,Grid > Label"> <Style Selector="Label">
<Setter Property="Layoutable.VerticalAlignment" Value="Center" /> <Setter Property="Margin" Value="4" />
<Setter Property="Layoutable.Margin" Value="4" /> </Style>
<Style Selector="Grid > TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="4" />
</Style> </Style>
</StackPanel.Styles> </StackPanel.Styles>
<ScrollViewer HorizontalScrollBarVisibility="Auto"> <ScrollViewer HorizontalScrollBarVisibility="Auto">
@@ -153,89 +156,69 @@
</HeaderedContentControl> </HeaderedContentControl>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<WrapPanel>
<HeaderedContentControl <Label Theme="{StaticResource TagLabel}">Label</Label>
Margin="16" <Label Classes="Large" Theme="{StaticResource TagLabel}">Large Label</Label>
Header="Theme: TagLabel" <Label Classes="Circle" Theme="{StaticResource TagLabel}">Circle Label</Label>
Theme="{DynamicResource GroupBox}"> <Label Classes="Large Circle" Theme="{StaticResource TagLabel}">Large Circle Label</Label>
<ScrollViewer HorizontalScrollBarVisibility="Auto"> </WrapPanel>
<StackPanel Orientation="Horizontal" Spacing="8"> <WrapPanel>
<StackPanel Spacing="4"> <Label Classes="Red" Theme="{StaticResource TagLabel}">Red</Label>
<Label Classes="Red" Theme="{StaticResource TagLabel}">Red</Label> <Label Classes="Pink" Theme="{StaticResource TagLabel}">Pink</Label>
<Label Classes="Pink" Theme="{StaticResource TagLabel}">Pink</Label> <Label Classes="Purple" Theme="{StaticResource TagLabel}">Purple</Label>
<Label Classes="Purple" Theme="{StaticResource TagLabel}">Purple</Label> <Label Classes="Violet" Theme="{StaticResource TagLabel}">Violet</Label>
<Label Classes="Violet" Theme="{StaticResource TagLabel}">Violet</Label> <Label Classes="Indigo" Theme="{StaticResource TagLabel}">Indigo</Label>
<Label Classes="Indigo" Theme="{StaticResource TagLabel}">Indigo</Label> <Label Classes="Blue" Theme="{StaticResource TagLabel}">Blue</Label>
<Label Classes="Blue" Theme="{StaticResource TagLabel}">Blue</Label> <Label Classes="LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label>
<Label Classes="LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label> <Label Classes="Cyan" Theme="{StaticResource TagLabel}">Cyan</Label>
<Label Classes="Cyan" Theme="{StaticResource TagLabel}">Cyan</Label> <Label Classes="Teal" Theme="{StaticResource TagLabel}">Teal</Label>
<Label Classes="Teal" Theme="{StaticResource TagLabel}">Teal</Label> <Label Classes="Green" Theme="{StaticResource TagLabel}">Green</Label>
<Label Classes="Green" Theme="{StaticResource TagLabel}">Green</Label> <Label Classes="LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label>
<Label Classes="LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label> <Label Classes="Lime" Theme="{StaticResource TagLabel}">Lime</Label>
<Label Classes="Lime" Theme="{StaticResource TagLabel}">Lime</Label> <Label Classes="Yellow" Theme="{StaticResource TagLabel}">Yellow</Label>
<Label Classes="Yellow" Theme="{StaticResource TagLabel}">Yellow</Label> <Label Classes="Amber" Theme="{StaticResource TagLabel}">Amber</Label>
<Label Classes="Amber" Theme="{StaticResource TagLabel}">Amber</Label> <Label Classes="Orange" Theme="{StaticResource TagLabel}">Orange</Label>
<Label Classes="Orange" Theme="{StaticResource TagLabel}">Orange</Label> <Label Classes="Grey" Theme="{StaticResource TagLabel}">Grey</Label>
<Label Classes="Grey" Theme="{StaticResource TagLabel}">Grey</Label> <Label Classes="White" Theme="{StaticResource TagLabel}">White</Label>
<Label Classes="White" Theme="{StaticResource TagLabel}">White</Label> </WrapPanel>
</StackPanel> <WrapPanel>
<StackPanel Spacing="4"> <Label Classes="Ghost Red" Theme="{StaticResource TagLabel}">Red</Label>
<Label Classes="Ghost Red" Theme="{StaticResource TagLabel}">Red</Label> <Label Classes="Ghost Pink" Theme="{StaticResource TagLabel}">Pink</Label>
<Label Classes="Ghost Pink" Theme="{StaticResource TagLabel}">Pink</Label> <Label Classes="Ghost Purple" Theme="{StaticResource TagLabel}">Purple</Label>
<Label Classes="Ghost Purple" Theme="{StaticResource TagLabel}">Purple</Label> <Label Classes="Ghost Violet" Theme="{StaticResource TagLabel}">Violet</Label>
<Label Classes="Ghost Violet" Theme="{StaticResource TagLabel}">Violet</Label> <Label Classes="Ghost Indigo" Theme="{StaticResource TagLabel}">Indigo</Label>
<Label Classes="Ghost Indigo" Theme="{StaticResource TagLabel}">Indigo</Label> <Label Classes="Ghost Blue" Theme="{StaticResource TagLabel}">Blue</Label>
<Label Classes="Ghost Blue" Theme="{StaticResource TagLabel}">Blue</Label> <Label Classes="Ghost LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label>
<Label Classes="Ghost LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label> <Label Classes="Ghost Cyan" Theme="{StaticResource TagLabel}">Cyan</Label>
<Label Classes="Ghost Cyan" Theme="{StaticResource TagLabel}">Cyan</Label> <Label Classes="Ghost Teal" Theme="{StaticResource TagLabel}">Teal</Label>
<Label Classes="Ghost Teal" Theme="{StaticResource TagLabel}">Teal</Label> <Label Classes="Ghost Green" Theme="{StaticResource TagLabel}">Green</Label>
<Label Classes="Ghost Green" Theme="{StaticResource TagLabel}">Green</Label> <Label Classes="Ghost LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label>
<Label Classes="Ghost LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label> <Label Classes="Ghost Lime" Theme="{StaticResource TagLabel}">Lime</Label>
<Label Classes="Ghost Lime" Theme="{StaticResource TagLabel}">Lime</Label> <Label Classes="Ghost Yellow" Theme="{StaticResource TagLabel}">Yellow</Label>
<Label Classes="Ghost Yellow" Theme="{StaticResource TagLabel}">Yellow</Label> <Label Classes="Ghost Amber" Theme="{StaticResource TagLabel}">Amber</Label>
<Label Classes="Ghost Amber" Theme="{StaticResource TagLabel}">Amber</Label> <Label Classes="Ghost Orange" Theme="{StaticResource TagLabel}">Orange</Label>
<Label Classes="Ghost Orange" Theme="{StaticResource TagLabel}">Orange</Label> <Label Classes="Ghost Grey" Theme="{StaticResource TagLabel}">Grey</Label>
<Label Classes="Ghost Grey" Theme="{StaticResource TagLabel}">Grey</Label> <Label Classes="Ghost White" Theme="{StaticResource TagLabel}">White</Label>
<Label Classes="Ghost White" Theme="{StaticResource TagLabel}">White</Label> </WrapPanel>
</StackPanel> <WrapPanel>
<StackPanel Spacing="4"> <Label Classes="Solid Red" Theme="{StaticResource TagLabel}">Red</Label>
<Label Classes="Solid Red" Theme="{StaticResource TagLabel}">Red</Label> <Label Classes="Solid Pink" Theme="{StaticResource TagLabel}">Pink</Label>
<Label Classes="Solid Pink" Theme="{StaticResource TagLabel}">Pink</Label> <Label Classes="Solid Purple" Theme="{StaticResource TagLabel}">Purple</Label>
<Label Classes="Solid Purple" Theme="{StaticResource TagLabel}">Purple</Label> <Label Classes="Solid Violet" Theme="{StaticResource TagLabel}">Violet</Label>
<Label Classes="Solid Violet" Theme="{StaticResource TagLabel}">Violet</Label> <Label Classes="Solid Indigo" Theme="{StaticResource TagLabel}">Indigo</Label>
<Label Classes="Solid Indigo" Theme="{StaticResource TagLabel}">Indigo</Label> <Label Classes="Solid Blue" Theme="{StaticResource TagLabel}">Blue</Label>
<Label Classes="Solid Blue" Theme="{StaticResource TagLabel}">Blue</Label> <Label Classes="Solid LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label>
<Label Classes="Solid LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label> <Label Classes="Solid Cyan" Theme="{StaticResource TagLabel}">Cyan</Label>
<Label Classes="Solid Cyan" Theme="{StaticResource TagLabel}">Cyan</Label> <Label Classes="Solid Teal" Theme="{StaticResource TagLabel}">Teal</Label>
<Label Classes="Solid Teal" Theme="{StaticResource TagLabel}">Teal</Label> <Label Classes="Solid Green" Theme="{StaticResource TagLabel}">Green</Label>
<Label Classes="Solid Green" Theme="{StaticResource TagLabel}">Green</Label> <Label Classes="Solid LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label>
<Label Classes="Solid LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label> <Label Classes="Solid Lime" Theme="{StaticResource TagLabel}">Lime</Label>
<Label Classes="Solid Lime" Theme="{StaticResource TagLabel}">Lime</Label> <Label Classes="Solid Yellow" Theme="{StaticResource TagLabel}">Yellow</Label>
<Label Classes="Solid Yellow" Theme="{StaticResource TagLabel}">Yellow</Label> <Label Classes="Solid Amber" Theme="{StaticResource TagLabel}">Amber</Label>
<Label Classes="Solid Amber" Theme="{StaticResource TagLabel}">Amber</Label> <Label Classes="Solid Orange" Theme="{StaticResource TagLabel}">Orange</Label>
<Label Classes="Solid Orange" Theme="{StaticResource TagLabel}">Orange</Label> <Label Classes="Solid Grey" Theme="{StaticResource TagLabel}">Grey</Label>
<Label Classes="Solid Grey" Theme="{StaticResource TagLabel}">Grey</Label> <Label Classes="Solid White" Theme="{StaticResource TagLabel}">White</Label>
<Label Classes="Solid White" Theme="{StaticResource TagLabel}">White</Label> </WrapPanel>
</StackPanel>
<StackPanel Spacing="4">
<Label Classes="Colorful Gradient" Theme="{DynamicResource TagLabel}">Light</Label>
<Label Classes="Colorful Gradient Ghost" Theme="{DynamicResource TagLabel}">Ghost</Label>
<Label Classes="Colorful Gradient Solid" Theme="{DynamicResource TagLabel}">Solid</Label>
</StackPanel>
<StackPanel Spacing="4">
<Label Classes="Colorful" Theme="{DynamicResource TagLabel}">Light</Label>
<Label Classes="Colorful Ghost" Theme="{DynamicResource TagLabel}">Ghost</Label>
<Label Classes="Colorful Solid" Theme="{DynamicResource TagLabel}">Solid</Label>
</StackPanel>
<StackPanel Spacing="4">
<Label Theme="{StaticResource TagLabel}">Label</Label>
<Label Classes="Large" Theme="{StaticResource TagLabel}">Large Label</Label>
<Label Classes="Circle" Theme="{StaticResource TagLabel}">Circle Label</Label>
<Label Classes="Large Circle" Theme="{StaticResource TagLabel}">Large Circle Label</Label>
</StackPanel>
</StackPanel>
</ScrollViewer>
</HeaderedContentControl>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</UserControl> </UserControl>

View File

@@ -27,8 +27,7 @@ public partial class NotificationDemo : UserControl
if (sender is RadioButton b && b.Content is string s) if (sender is RadioButton b && b.Content is string s)
{ {
Enum.TryParse<NotificationPosition>(s, out var t); Enum.TryParse<NotificationPosition>(s, out var t);
if (_manager is not null) _manager.Position = t;
_manager.Position = t;
} }
} }

View File

@@ -28,15 +28,15 @@
<NumericUpDown <NumericUpDown
Width="100" Width="100"
Classes="Large" Classes="Large"
PlaceholderText="Large" Watermark="Large"
ButtonSpinnerLocation="Left" /> ButtonSpinnerLocation="Left" />
<NumericUpDown <NumericUpDown
Width="100" Width="100"
PlaceholderText="Default" Watermark="Default"
ShowButtonSpinner="False" /> ShowButtonSpinner="False" />
<NumericUpDown <NumericUpDown
Width="100" Width="100"
PlaceholderText="Small" Watermark="Small"
Classes="Small" /> Classes="Small" />
</StackPanel> </StackPanel>

View File

@@ -353,12 +353,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].MainInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].MainInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].MainStyle}" Text="{Binding $parent[local:Overview].MainStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -368,12 +368,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].ColorPickerInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].ColorPickerInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].ColorPickerStyle}" Text="{Binding $parent[local:Overview].ColorPickerStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -383,12 +383,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].DataGridInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].DataGridInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].DataGridStyle}" Text="{Binding $parent[local:Overview].DataGridStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -398,12 +398,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].TreeDataGridInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].TreeDataGridInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].TreeDataGridStyle}" Text="{Binding $parent[local:Overview].TreeDataGridStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -413,12 +413,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].DockInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].DockInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].DockStyle}" Text="{Binding $parent[local:Overview].DockStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -428,12 +428,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].TabaloniaInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].TabaloniaInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].TabaloniaStyle}" Text="{Binding $parent[local:Overview].TabaloniaStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>
@@ -443,12 +443,12 @@
<StackPanel> <StackPanel>
<TextBlock Text="Install via nuget: " /> <TextBlock Text="Install via nuget: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock Text="{Binding $parent[local:Overview].AvaloniaEditInstall}" /> <SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].AvaloniaEditInstall}" />
</Border> </Border>
<TextBlock Text="Reference styles: " /> <TextBlock Text="Reference styles: " />
<Border Margin="0,16" Classes="CodeBlock"> <Border Margin="0,16" Classes="CodeBlock">
<SelectableTextBlock <SelectableTextBlock
FontFamily="Consolas"
Text="{Binding $parent[local:Overview].AvaloniaEditStyle}" Text="{Binding $parent[local:Overview].AvaloniaEditStyle}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Border> </Border>

View File

@@ -9,7 +9,7 @@ public partial class Overview : UserControl
InitializeComponent(); InitializeComponent();
} }
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia"; public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.2.1.9";
public string MainStyle { get; set; } = public string MainStyle { get; set; } =
""" """
@@ -18,7 +18,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker"; public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.2.1.9";
public string ColorPickerStyle { get; set; } = public string ColorPickerStyle { get; set; } =
""" """
@@ -27,7 +27,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid"; public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.2.1.9";
public string DataGridStyle { get; set; } = public string DataGridStyle { get; set; } =
""" """
@@ -36,7 +36,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid"; public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.10.4";
public string TreeDataGridStyle { get; set; } = public string TreeDataGridStyle { get; set; } =
""" """
@@ -45,7 +45,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string DockInstall { get; set; } = "dotnet add package Semi.Avalonia.Dock"; public string DockInstall { get; set; } = "dotnet add package Semi.Avalonia.Dock --version 11.3.0";
public string DockStyle { get; set; } = public string DockStyle { get; set; } =
""" """
@@ -54,7 +54,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string TabaloniaInstall { get; set; } = "dotnet add package Semi.Avalonia.Tabalonia"; public string TabaloniaInstall { get; set; } = "dotnet add package Semi.Avalonia.Tabalonia --version 11.0.0-beta1";
public string TabaloniaStyle { get; set; } = public string TabaloniaStyle { get; set; } =
""" """
@@ -63,7 +63,7 @@ public partial class Overview : UserControl
</Application.Styles> </Application.Styles>
"""; """;
public string AvaloniaEditInstall { get; set; } = "dotnet add package Semi.Avalonia.AvaloniaEdit"; public string AvaloniaEditInstall { get; set; } = "dotnet add package Semi.Avalonia.AvaloniaEdit --version 11.2.0";
public string AvaloniaEditStyle { get; set; } = public string AvaloniaEditStyle { get; set; } =
""" """

View File

@@ -8,6 +8,7 @@
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="viewModels:PaletteDemoViewModel" x:DataType="viewModels:PaletteDemoViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<Design.DataContext> <Design.DataContext>

View File

@@ -1,7 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input.Platform;
using Avalonia.Threading; using Avalonia.Threading;
using Semi.Avalonia.Demo.ViewModels; using Semi.Avalonia.Demo.ViewModels;

View File

@@ -8,6 +8,7 @@
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:DataType="vm:RefreshContainerDemoViewModel" x:DataType="vm:RefreshContainerDemoViewModel"
x:CompileBindings="True"
mc:Ignorable="d"> mc:Ignorable="d">
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Top"> <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Label DockPanel.Dock="Top">A control that supports pull to refresh</Label> <Label DockPanel.Dock="Top">A control that supports pull to refresh</Label>

View File

@@ -0,0 +1,80 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.RepeatButtonDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel HorizontalAlignment="Left" Spacing="20">
<TextBlock>Light (Default)</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary">Primary</RepeatButton>
<RepeatButton Classes="Secondary">Secondary</RepeatButton>
<RepeatButton Classes="Tertiary">Tertiary</RepeatButton>
<RepeatButton Classes="Success">Success</RepeatButton>
<RepeatButton Classes="Warning">Warning</RepeatButton>
<RepeatButton Classes="Danger">Danger</RepeatButton>
<RepeatButton Classes="Danger" IsEnabled="False">Disabled</RepeatButton>
</StackPanel>
<TextBlock>Solid</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary" Theme="{DynamicResource SolidRepeatButton}">Primary</RepeatButton>
<RepeatButton Classes="Secondary" Theme="{DynamicResource SolidRepeatButton}">Secondary</RepeatButton>
<RepeatButton Classes="Tertiary" Theme="{DynamicResource SolidRepeatButton}">Tertiary</RepeatButton>
<RepeatButton Classes="Success" Theme="{DynamicResource SolidRepeatButton}">Success</RepeatButton>
<RepeatButton Classes="Warning" Theme="{DynamicResource SolidRepeatButton}">Warning</RepeatButton>
<RepeatButton Classes="Danger" Theme="{DynamicResource SolidRepeatButton}">Danger</RepeatButton>
<RepeatButton
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource SolidRepeatButton}">
Disabled
</RepeatButton>
</StackPanel>
<TextBlock>Outline</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary" Theme="{DynamicResource OutlineRepeatButton}">Primary</RepeatButton>
<RepeatButton Classes="Secondary" Theme="{DynamicResource OutlineRepeatButton}">Secondary</RepeatButton>
<RepeatButton Classes="Tertiary" Theme="{DynamicResource OutlineRepeatButton}">Tertiary</RepeatButton>
<RepeatButton Classes="Success" Theme="{DynamicResource OutlineRepeatButton}">Success</RepeatButton>
<RepeatButton Classes="Warning" Theme="{DynamicResource OutlineRepeatButton}">Warning</RepeatButton>
<RepeatButton Classes="Danger" Theme="{DynamicResource OutlineRepeatButton}">Danger</RepeatButton>
<RepeatButton
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource OutlineRepeatButton}">
Disabled
</RepeatButton>
</StackPanel>
<TextBlock>Borderless</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary" Theme="{DynamicResource BorderlessRepeatButton}">Primary</RepeatButton>
<RepeatButton Classes="Secondary" Theme="{DynamicResource BorderlessRepeatButton}">Secondary</RepeatButton>
<RepeatButton Classes="Tertiary" Theme="{DynamicResource BorderlessRepeatButton}">Tertiary</RepeatButton>
<RepeatButton Classes="Success" Theme="{DynamicResource BorderlessRepeatButton}">Success</RepeatButton>
<RepeatButton Classes="Warning" Theme="{DynamicResource BorderlessRepeatButton}">Warning</RepeatButton>
<RepeatButton Classes="Danger" Theme="{DynamicResource BorderlessRepeatButton}">Danger</RepeatButton>
<RepeatButton
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource BorderlessRepeatButton}">
Disabled
</RepeatButton>
</StackPanel>
<TextBlock>Disabled</TextBlock>
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<Button IsEnabled="False">Light</Button>
<Button IsEnabled="False" Theme="{DynamicResource SolidButton}">Solid</Button>
<Button IsEnabled="False" Theme="{DynamicResource OutlineButton}">Outline</Button>
<Button IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Borderless</Button>
</StackPanel>
<TextBlock>Size Classes</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Small">Small</RepeatButton>
<RepeatButton>Default</RepeatButton>
<RepeatButton Classes="Large">Large</RepeatButton>
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,11 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Demo.Pages;
public partial class RepeatButtonDemo : UserControl
{
public RepeatButtonDemo()
{
InitializeComponent();
}
}

View File

@@ -22,15 +22,6 @@
TickFrequency="10" TickFrequency="10"
TickPlacement="Outside" TickPlacement="Outside"
Value="0" /> Value="0" />
<Slider
Value="0"
Minimum="0"
Maximum="100"
TickPlacement="BottomRight"
IsSnapToTickEnabled="True"
IsDirectionReversed="True"
Ticks="0,20,25,40,75,100"
Width="300" />
<Slider <Slider
Width="300" Width="300"
Classes="ToolTip" Classes="ToolTip"

View File

@@ -7,187 +7,276 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="1000" d:DesignHeight="1000"
d:DesignWidth="800" d:DesignWidth="800"
x:DataType="vm:SplitViewDemoViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<Design.DataContext> <Design.DataContext>
<vm:SplitViewDemoViewModel /> <vm:SplitViewDemoViewModel />
</Design.DataContext> </Design.DataContext>
<Border> <Border>
<Grid ColumnDefinitions="*,400"> <Grid ColumnDefinitions="*,400">
<Border <Border Grid.Column="1" VerticalAlignment="Top" Margin="10 0 0 0">
Grid.Column="1" <Grid RowDefinitions="*, *, *, *, *, *" ColumnDefinitions="Auto, *">
Margin="10,0,0,0"
VerticalAlignment="Top">
<Grid ColumnDefinitions="Auto, *" RowDefinitions="*, *, *, *, *, *">
<Label <Label
Grid.Row="0" Grid.Row="0" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="IsPaneOpen" /> Content="IsPaneOpen" />
<ToggleSwitch <ToggleSwitch
Name="PaneOpenButton" Grid.Row="0" Grid.Column="1"
Grid.Row="0" Name="PaneOpenButton" />
Grid.Column="1" />
<Label <Label
Grid.Row="1" Grid.Row="1" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="UseLightDismissOverlayMode" /> Content="UseLightDismissOverlayMode" />
<ToggleSwitch <ToggleSwitch
Name="UseLightDismissOverlayModeButton" Grid.Row="1" Grid.Column="1"
Grid.Row="1" Name="UseLightDismissOverlayModeButton" />
Grid.Column="1" />
<Label <Label
Grid.Row="2" Grid.Row="2" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="Placement" /> Content="Placement" />
<ComboBox <ToggleSwitch
Grid.Row="2" Grid.Row="2" Grid.Column="1"
Grid.Column="1" Name="PanePlacementButton"
Name="PanelPlacementSelector" OffContent="Left"
HorizontalAlignment="Stretch" OnContent="Right" />
ItemsSource="{x:Static vm:SplitViewDemoViewModel.Placements}"
SelectedItem="{x:Static SplitViewPanePlacement.Left}"
/>
<Label <Label
Grid.Row="3" Grid.Row="3" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="DisplayMode" /> Content="DisplayMode" />
<ComboBox <ComboBox
Grid.Row="3" Grid.Column="1"
Name="DisplayModeSelector" Name="DisplayModeSelector"
Grid.Row="3"
Grid.Column="1"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
ItemsSource="{x:Static vm:SplitViewDemoViewModel.DisplayModes}" ItemsSource="{x:Static vm:SplitViewDemoViewModel.DisplayModes}"
SelectedItem="{x:Static SplitViewDisplayMode.CompactInline}" /> SelectedItem="{x:Static SplitViewDisplayMode.CompactInline}" />
<Label <Label
Grid.Row="4" Grid.Row="4" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{Binding #CompactPaneLengthSlider.Value, StringFormat='{}CompactPaneLength: {0}'}" /> Content="{Binding #CompactPaneLengthSlider.Value, StringFormat='{}CompactPaneLength: {0}'}" />
<Slider <Slider
Grid.Row="4" Grid.Column="1"
Name="CompactPaneLengthSlider" Name="CompactPaneLengthSlider"
Grid.Row="4"
Grid.Column="1"
IsSnapToTickEnabled="True"
Maximum="128" Maximum="128"
Minimum="0" Minimum="0"
TickFrequency="1" TickFrequency="1"
IsSnapToTickEnabled="True"
Value="48" /> Value="48" />
<Label <Label
Grid.Row="5" Grid.Row="5" Grid.Column="0"
Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{Binding #OpenPaneLengthSlider.Value, StringFormat='{}OpenPaneLength: {0}'}" /> Content="{Binding #OpenPaneLengthSlider.Value,StringFormat='{}OpenPaneLength: {0}'}" />
<Slider <Slider
Grid.Row="5" Grid.Column="1"
Name="OpenPaneLengthSlider" Name="OpenPaneLengthSlider"
Grid.Row="5"
Grid.Column="1"
IsSnapToTickEnabled="True"
Maximum="500" Maximum="500"
Minimum="128" Minimum="128"
TickFrequency="1" TickFrequency="1"
IsSnapToTickEnabled="True"
Value="256" /> Value="256" />
</Grid> </Grid>
</Border> </Border>
<SplitView <TabControl Grid.Column="0">
Grid.Column="0" <TabItem Header="Default">
Name="SplitView" <Border
CompactPaneLength="{Binding #CompactPaneLengthSlider.Value}" BorderBrush="{DynamicResource SemiGrey1}"
DisplayMode="{Binding #DisplayModeSelector.SelectedItem}" BorderThickness="1">
IsPaneOpen="{Binding #PaneOpenButton.IsChecked, Mode=TwoWay}" <SplitView
OpenPaneLength="{Binding #OpenPaneLengthSlider.Value}" Name="SplitView"
PanePlacement="{Binding #PanelPlacementSelector.SelectedItem}" IsPaneOpen="{Binding #PaneOpenButton.IsChecked,Mode=TwoWay}"
UseLightDismissOverlayMode="{Binding #UseLightDismissOverlayModeButton.IsChecked}"> UseLightDismissOverlayMode="{Binding #UseLightDismissOverlayModeButton.IsChecked}"
<SplitView.Background> PanePlacement="{Binding #PanePlacementButton.IsChecked}"
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%"> DisplayMode="{Binding #DisplayModeSelector.SelectedItem}"
<GradientStop Offset="0" Color="#6b4c1b" /> CompactPaneLength="{Binding #CompactPaneLengthSlider.Value}"
<GradientStop Offset="1" Color="#291e10" /> OpenPaneLength="{Binding #OpenPaneLengthSlider.Value}">
</LinearGradientBrush> <SplitView.Background>
</SplitView.Background> <LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%">
<SplitView.Pane> <GradientStop Color="#6b4c1b" Offset="0" />
<Grid RowDefinitions="Auto,*,Auto"> <GradientStop Color="#291e10" Offset="1" />
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="8 12"> </LinearGradientBrush>
<ToggleSwitch </SplitView.Background>
Content="{StaticResource SemiIconSidebar}" <SplitView.Pane>
IsChecked="{Binding #SplitView.IsPaneOpen}" <Grid RowDefinitions="Auto,*,Auto">
Theme="{DynamicResource IconBorderlessToggleSwitch}" /> <TextBlock
<TextBlock Grid.Row="0"
Name="PaneHeader" Name="PaneHeader"
VerticalAlignment="Center" Margin="8,12"
Margin="8 0" FontWeight="Bold"
FontWeight="Bold" Text="Playlist" />
Text="Playlist" /> <ListBox
</StackPanel> Grid.Row="1"
ItemsSource="{Binding Songs}" />
<ListBox Grid.Row="1" ItemsSource="{Binding Songs}" /> <ToggleSwitch
Grid.Row="2"
</Grid> Theme="{DynamicResource IconBorderlessToggleSwitch}"
</SplitView.Pane> Content="{StaticResource SemiIconSidebar}"
HorizontalAlignment="Left"
IsChecked="{Binding #SplitView.IsPaneOpen}" />
</Grid>
</SplitView.Pane>
<Panel> <Panel>
<Panel.Styles> <Panel.Styles>
<Style Selector="Image#AlbumCover"> <Style Selector="Image#AlbumCover">
<Style.Animations> <Style.Animations>
<Animation IterationCount="Infinite" Duration="0:0:40"> <Animation IterationCount="Infinite" Duration="0:0:40">
<KeyFrame Cue="0%"> <KeyFrame Cue="0%">
<Setter Property="RotateTransform.Angle" Value="0" /> <Setter Property="RotateTransform.Angle" Value="0" />
</KeyFrame> </KeyFrame>
<KeyFrame Cue="100%"> <KeyFrame Cue="100%">
<Setter Property="RotateTransform.Angle" Value="360" /> <Setter Property="RotateTransform.Angle" Value="360" />
</KeyFrame> </KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>
</Style> </Style>
</Panel.Styles> </Panel.Styles>
<Image <Image
Name="AlbumCover" Source="/Assets/WORLD.png"
Width="200" Name="AlbumCover"
Height="200" Width="200"
Source="/Assets/WORLD.png" /> Height="200" />
<Arc <Arc
Width="290" Width="290"
Height="290" Height="290"
StartAngle="0" StartAngle="0"
StrokeJoin="Round" SweepAngle="360"
StrokeLineCap="Round" StrokeJoin="Round"
StrokeThickness="45" StrokeLineCap="Round"
SweepAngle="360"> StrokeThickness="45">
<Arc.Stroke> <Arc.Stroke>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,0%"> <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,0%">
<GradientStop Offset="0" Color="#010101" /> <GradientStop Color="#010101" Offset="0" />
<GradientStop Offset="0.5" Color="#363636" /> <GradientStop Color="#363636" Offset="0.5" />
<GradientStop Offset="1" Color="#010101" /> <GradientStop Color="#010101" Offset="1" />
</LinearGradientBrush> </LinearGradientBrush>
</Arc.Stroke> </Arc.Stroke>
</Arc> </Arc>
<Arc <Arc
Width="294" Width="294"
Height="294" Height="294"
StartAngle="0" StartAngle="0"
Stroke="Black" SweepAngle="360"
StrokeJoin="Round" StrokeJoin="Round"
StrokeLineCap="Round" StrokeLineCap="Round"
StrokeThickness="4" StrokeThickness="4"
SweepAngle="360" /> Stroke="Black" />
<Arc <Arc
Width="310" Width="310"
Height="310" Height="310"
Opacity="0.1" StartAngle="0"
StartAngle="0" SweepAngle="360"
Stroke="#C6CACD" StrokeJoin="Round"
StrokeJoin="Round" StrokeLineCap="Round"
StrokeLineCap="Round" StrokeThickness="10"
StrokeThickness="10" Stroke="#C6CACD"
SweepAngle="360" /> Opacity="0.1" />
</Panel> </Panel>
</SplitView>
</SplitView>
</Border>
</TabItem>
<TabItem Header="VerticalSplitView">
<Border
BorderBrush="{DynamicResource SemiGrey1}"
BorderThickness="1">
<SplitView
Name="SplitView2"
Theme="{DynamicResource VerticalSplitView}"
IsPaneOpen="{Binding #PaneOpenButton.IsChecked,Mode=TwoWay}"
UseLightDismissOverlayMode="{Binding #UseLightDismissOverlayModeButton.IsChecked}"
PanePlacement="{Binding #PanePlacementButton.IsChecked}"
DisplayMode="{Binding #DisplayModeSelector.SelectedItem}"
CompactPaneLength="{Binding #CompactPaneLengthSlider.Value}"
OpenPaneLength="{Binding #OpenPaneLengthSlider.Value}">
<SplitView.Background>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="#6b4c1b" Offset="0" />
<GradientStop Color="#291e10" Offset="1" />
</LinearGradientBrush>
</SplitView.Background>
<SplitView.Pane>
<Grid RowDefinitions="Auto,Auto,*">
<ToggleSwitch
Grid.Row="0"
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}"
HorizontalAlignment="Left"
IsChecked="{Binding #SplitView2.IsPaneOpen}" />
<TextBlock
Grid.Row="1"
Margin="8,12"
FontWeight="Bold"
Text="Playlist" />
<ListBox
Grid.Row="2"
ItemsSource="{Binding Songs}" />
</Grid>
</SplitView.Pane>
<Panel>
<Panel.Styles>
<Style Selector="Image#AlbumCover2">
<Style.Animations>
<Animation IterationCount="Infinite" Duration="0:0:40">
<KeyFrame Cue="0%">
<Setter Property="RotateTransform.Angle" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="RotateTransform.Angle" Value="360" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Panel.Styles>
<Image
Source="/Assets/WORLD.png"
Name="AlbumCover2"
Width="200"
Height="200" />
<Arc
Width="290"
Height="290"
StartAngle="0"
SweepAngle="360"
StrokeJoin="Round"
StrokeLineCap="Round"
StrokeThickness="45">
<Arc.Stroke>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,0%">
<GradientStop Color="#010101" Offset="0" />
<GradientStop Color="#363636" Offset="0.5" />
<GradientStop Color="#010101" Offset="1" />
</LinearGradientBrush>
</Arc.Stroke>
</Arc>
<Arc
Width="294"
Height="294"
StartAngle="0"
SweepAngle="360"
StrokeJoin="Round"
StrokeLineCap="Round"
StrokeThickness="4"
Stroke="Black" />
<Arc
Width="310"
Height="310"
StartAngle="0"
SweepAngle="360"
StrokeJoin="Round"
StrokeLineCap="Round"
StrokeThickness="10"
Stroke="#C6CACD"
Opacity="0.1" />
</Panel>
</SplitView>
</Border>
</TabItem>
</TabControl>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>

View File

@@ -7,6 +7,7 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:TabControlDemoViewModel" x:DataType="vm:TabControlDemoViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<ScrollViewer> <ScrollViewer>

View File

@@ -5,6 +5,7 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Semi.Avalonia.Demo.Pages.TabStripDemo" x:Class="Semi.Avalonia.Demo.Pages.TabStripDemo"
x:CompileBindings="True"
x:DataType="vm:TabStripDemoViewModel"> x:DataType="vm:TabStripDemoViewModel">
<Design.DataContext> <Design.DataContext>
<vm:TabStripDemoViewModel /> <vm:TabStripDemoViewModel />

View File

@@ -23,36 +23,36 @@
<TextBox <TextBox
Width="100" Width="100"
Classes="Large" Classes="Large"
PlaceholderText="Large" /> Watermark="Large" />
<TextBox <TextBox
Width="100" Width="100"
PlaceholderText="Default" /> Watermark="Default" />
<TextBox <TextBox
Width="100" Width="100"
Classes="Small" Classes="Small"
PlaceholderText="Small" /> Watermark="Small" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBox <TextBox
Width="100" Width="100"
IsEnabled="False" IsEnabled="False"
PlaceholderText="Disabled" /> Watermark="Disabled" />
<TextBox <TextBox
Width="100" Width="100"
Classes="Bordered" Classes="Bordered"
PlaceholderText="Bordered" /> Watermark="Bordered" />
<TextBox <TextBox
Width="100" Width="100"
Classes="Bordered" Classes="Bordered"
IsEnabled="False" /> IsEnabled="False" />
</StackPanel> </StackPanel>
<TextBox Width="300" Classes="TextArea" PlaceholderText="TextArea TextBox" /> <TextBox Width="300" Classes="TextArea" Watermark="TextArea TextBox" />
<TextBox Width="300" Classes="TextArea ClearButton" Text="TextArea with ClearButton - text should be clearable" /> <TextBox Width="300" Classes="TextArea ClearButton" Text="TextArea with ClearButton - text should be clearable" />
<TextBox <TextBox
Width="300" Width="300"
Theme="{StaticResource LooklessTextBox}" Theme="{StaticResource LooklessTextBox}"
PlaceholderText="Lookless TextBox" Watermark="Lookless TextBox"
InnerLeftContent="https://" InnerLeftContent="https://"
InnerRightContent=".com" /> InnerRightContent=".com" />
</StackPanel> </StackPanel>

View File

@@ -0,0 +1,98 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.ToggleButtonDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel Spacing="20">
<TextBlock Text="Toggle Button (Default)" />
<StackPanel Orientation="Horizontal" Spacing="20">
<ToggleButton>Default</ToggleButton>
<ToggleButton Classes="Primary">Primary</ToggleButton>
<ToggleButton Classes="Secondary">Secondary</ToggleButton>
<ToggleButton Classes="Tertiary">Tertiary</ToggleButton>
<ToggleButton Classes="Success">Success</ToggleButton>
<ToggleButton Classes="Warning">Warning</ToggleButton>
<ToggleButton Classes="Danger">Danger</ToggleButton>
<ToggleButton Classes="Danger" IsEnabled="False">Disabled</ToggleButton>
</StackPanel>
<TextBlock Text="Toggle Button Checked State" />
<StackPanel Orientation="Horizontal" Spacing="20">
<ToggleButton IsChecked="True">Default</ToggleButton>
<ToggleButton Classes="Primary" IsChecked="True">Primary</ToggleButton>
<ToggleButton Classes="Secondary" IsChecked="True">Secondary</ToggleButton>
<ToggleButton Classes="Tertiary" IsChecked="True">Tertiary</ToggleButton>
<ToggleButton Classes="Success" IsChecked="True">Success</ToggleButton>
<ToggleButton Classes="Warning" IsChecked="True">Warning</ToggleButton>
<ToggleButton Classes="Danger" IsChecked="True">Danger</ToggleButton>
<ToggleButton
Classes="Danger"
IsChecked="True"
IsEnabled="False">
Disabled
</ToggleButton>
</StackPanel>
<TextBlock Text="Toggle Button Three State" />
<StackPanel Orientation="Horizontal" Spacing="20">
<ToggleButton IsChecked="{x:Null}" IsThreeState="True">Default</ToggleButton>
<ToggleButton
Classes="Primary"
IsChecked="{x:Null}"
IsThreeState="True">
Primary
</ToggleButton>
<ToggleButton
Classes="Secondary"
IsChecked="{x:Null}"
IsThreeState="True">
Secondary
</ToggleButton>
<ToggleButton
Classes="Tertiary"
IsChecked="{x:Null}"
IsThreeState="True">
Tertiary
</ToggleButton>
<ToggleButton
Classes="Success"
IsChecked="{x:Null}"
IsThreeState="True">
Success
</ToggleButton>
<ToggleButton
Classes="Warning"
IsChecked="{x:Null}"
IsThreeState="True">
Warning
</ToggleButton>
<ToggleButton
Classes="Danger"
IsChecked="{x:Null}"
IsThreeState="True">
Danger
</ToggleButton>
<ToggleButton
Classes="Danger"
IsChecked="{x:Null}"
IsEnabled="False"
IsThreeState="True">
Disabled
</ToggleButton>
</StackPanel>
<TextBlock Text="Toggle Button Disabled State" />
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<ToggleButton IsThreeState="True" IsEnabled="False">Default</ToggleButton>
<ToggleButton IsThreeState="True" IsEnabled="False" IsChecked="True">Checked</ToggleButton>
<ToggleButton IsThreeState="True" IsEnabled="False" IsChecked="{x:Null}">Indeterminate</ToggleButton>
</StackPanel>
<TextBlock Text="Toggle Button Size" />
<StackPanel Orientation="Horizontal" Spacing="20">
<ToggleButton Classes="Small" IsThreeState="True">Small</ToggleButton>
<ToggleButton IsThreeState="True">Default</ToggleButton>
<ToggleButton Classes="Large" IsThreeState="True">Large</ToggleButton>
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,11 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Demo.Pages;
public partial class ToggleButtonDemo : UserControl
{
public ToggleButtonDemo()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,127 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:converters="clr-namespace:Semi.Avalonia.Demo.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Semi.Avalonia.Demo.Pages.TreeDataGridDemo"
x:CompileBindings="True"
x:DataType="vm:TreeDataGridDemoViewModel">
<UserControl.Resources>
<converters:FileIconConverter x:Key="FileIconConverter">
<StaticResource x:Key="file" ResourceKey="SemiIconFile" />
<StaticResource x:Key="folderOpen" ResourceKey="SemiIconFolderOpen" />
<StaticResource x:Key="folderClosed" ResourceKey="SemiIconFolder" />
</converters:FileIconConverter>
</UserControl.Resources>
<TabControl>
<TabItem Header="Songs">
<TreeDataGrid
AutoDragDropRows="True"
DataContext="{Binding SongsContext}"
Source="{Binding Songs}">
<TreeDataGrid.Resources>
<DataTemplate x:Key="AlbumCell" DataType="vm:SongViewModel">
<TextBlock
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Background="Transparent"
Text="{Binding Album}" />
</DataTemplate>
<DataTemplate x:Key="AlbumEditCell" DataType="vm:SongViewModel">
<ComboBox
VerticalAlignment="Center"
Classes="Small"
ItemsSource="{x:Static vm:Song.Albums}"
SelectedItem="{Binding Album}" />
</DataTemplate>
<DataTemplate x:Key="CommentsCell" DataType="vm:SongViewModel">
<TextBlock VerticalAlignment="Center" Text="{Binding CountOfComment}" />
</DataTemplate>
<DataTemplate x:Key="CommentsEditCell" DataType="vm:SongViewModel">
<NumericUpDown
Width="100"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Classes="Small"
Value="{Binding CountOfComment}" />
</DataTemplate>
</TreeDataGrid.Resources>
<TreeDataGrid.Styles>
<Style Selector="TreeDataGrid TreeDataGridRow:nth-last-child(2n)">
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
</Style>
</TreeDataGrid.Styles>
</TreeDataGrid>
</TabItem>
<TabItem Header="Files">
<Grid DataContext="{Binding FilesContext}" RowDefinitions="Auto, *">
<DockPanel Margin="0,4" DockPanel.Dock="Top">
<ComboBox
DockPanel.Dock="Left"
ItemsSource="{Binding Drives}"
SelectedItem="{Binding SelectedDrive}" />
<TextBox
Margin="4,0,0,0"
VerticalContentAlignment="Center"
KeyDown="SelectedPath_KeyDown"
Text="{Binding SelectedPath, Mode=OneWay}" />
</DockPanel>
<TreeDataGrid
Name="fileViewer"
Grid.Row="1"
Source="{Binding Source}">
<TreeDataGrid.Resources>
<!-- Template for Name column cells -->
<DataTemplate x:Key="FileNameCell" DataType="vm:FileNodeViewModel">
<StackPanel Orientation="Horizontal">
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Margin="8,0">
<PathIcon.Data>
<MultiBinding Converter="{StaticResource FileIconConverter}">
<Binding Path="IsDirectory" />
<Binding Path="IsExpanded" />
</MultiBinding>
</PathIcon.Data>
</PathIcon>
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
<!-- Edit template for Name column cells -->
<DataTemplate x:Key="FileNameEditCell" DataType="vm:FileNodeViewModel">
<StackPanel Orientation="Horizontal">
<Image Margin="0,0,4,0" VerticalAlignment="Center">
<Image.Source>
<MultiBinding Converter="{StaticResource FileIconConverter}">
<Binding Path="IsDirectory" />
<Binding Path="IsExpanded" />
</MultiBinding>
</Image.Source>
</Image>
<TextBox
VerticalAlignment="Center"
Classes="Small"
Text="{Binding Name}">
<TextBox.Styles>
<Style Selector="DataValidationErrors">
<Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
</Style>
</TextBox.Styles>
</TextBox>
</StackPanel>
</DataTemplate>
</TreeDataGrid.Resources>
<TreeDataGrid.Styles>
<Style Selector="TreeDataGrid TreeDataGridRow:nth-child(2n)">
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
</Style>
</TreeDataGrid.Styles>
</TreeDataGrid>
</Grid>
</TabItem>
</TabControl>
</UserControl>

View File

@@ -0,0 +1,23 @@
using Avalonia.Controls;
using Avalonia.Input;
using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages;
public partial class TreeDataGridDemo : UserControl
{
public TreeDataGridDemo()
{
InitializeComponent();
this.DataContext = new TreeDataGridDemoViewModel();
}
private void SelectedPath_KeyDown(object? sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
var vm = DataContext as TreeDataGridDemoViewModel;
vm.FilesContext.SelectedPath = (sender as TextBox)!.Text;
}
}
}

View File

@@ -8,6 +8,7 @@
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.Pages" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.Pages"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:TreeViewVm" x:DataType="vm:TreeViewVm"
mc:Ignorable="d"> mc:Ignorable="d">

View File

@@ -21,40 +21,33 @@ public class TreeViewVm : ObservableObject
public TreeViewVm() public TreeViewVm()
{ {
Items = Items = new ObservableCollection<TreeViewItemVm>()
[
new TreeViewItemVm { Name = "Item 1", Id = "1" },
new TreeViewItemVm { Name = "Item 2", Id = "2" },
new TreeViewItemVm
{
Name = "Item 3", Id = "3", Items =
[
new TreeViewItemVm { Name = "Item 3.1", Id = "3.1" },
new TreeViewItemVm { Name = "Item 3.2", Id = "3.2" },
new TreeViewItemVm { Name = "Item 3.3", Id = "3.3" }
],
}
];
MultipleLevelItems = [];
for (var i = 1; i < 6; i++)
{ {
var firstItem = new FirstItem new TreeViewItemVm() { Name = "Item 1", Id = "1" },
new TreeViewItemVm() { Name = "Item 2", Id = "2" },
new TreeViewItemVm()
{ {
Id = i, Name = $"FirstItem {i}", Name = "Item 3", Id = "3", Items = new ObservableCollection<TreeViewItemVm>()
SecondItems = [] {
}; new TreeViewItemVm() { Name = "Item 3.1", Id = "3.1" },
for (var j = 1; j < 6; j++) new TreeViewItemVm() { Name = "Item 3.2", Id = "3.2" },
new TreeViewItemVm() { Name = "Item 3.3", Id = "3.3" },
},
},
};
MultipleLevelItems = new();
for (int i = 1; i < 6; i++)
{
FirstItem firstItem = new FirstItem { Id = i, Name = $"FirstItem {i}" };
firstItem.SecondItems = new();
for (int j = 1; j < 6; j++)
{ {
var secondItem = new SecondItem SecondItem secondItem = new SecondItem { Id = j, Name = $"SecondItem {j}" };
secondItem.ThirdItemItems = new();
for (int k = 1; k < 6; k++)
{ {
Id = j, Name = $"SecondItem {j}", ThirdItem thirdItem = new ThirdItem { Id = k, Name = $"ThirdItem {k}" };
ThirdItemItems = []
};
for (var k = 1; k < 6; k++)
{
var thirdItem = new ThirdItem { Id = k, Name = $"ThirdItem {k}" };
secondItem.ThirdItemItems.Add(thirdItem); secondItem.ThirdItemItems.Add(thirdItem);
} }
@@ -68,9 +61,9 @@ public class TreeViewVm : ObservableObject
public partial class TreeViewItemVm : ObservableObject public partial class TreeViewItemVm : ObservableObject
{ {
public ObservableCollection<TreeViewItemVm> Items { get; set; } = []; public ObservableCollection<TreeViewItemVm> Items { get; set; }
public string? Name { get; set; } public string Name { get; set; }
public string? Id { get; set; } public string Id { get; set; }
} }
public class ItemBase public class ItemBase

View File

@@ -0,0 +1,94 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Semi.Avalonia.Demo.Pages.VariablesDemo"
x:DataType="vm:VariablesDemoViewModel"
x:CompileBindings="True">
<Design.DataContext>
<vm:VariablesDemoViewModel />
</Design.DataContext>
<DataGrid
Margin="8"
CanUserReorderColumns="True"
CanUserResizeColumns="True"
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ItemsSource="{Binding GridData}">
<DataGrid.Columns>
<DataGridTemplateColumn
Width="300"
x:DataType="vm:VariableItem"
Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
Width="200"
x:DataType="vm:VariableItem"
Header="Type">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Type.Name}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
Width="200"
x:DataType="vm:VariableItem"
Header="Value">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Value}"
TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
Width="*"
x:DataType="vm:VariableItem"
Header="Description">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Description}"
TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn
Width="100"
x:DataType="vm:VariableItem"
Header="CopyText"
SortMemberPath="Duration">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem">
<Button
Command="{Binding $parent[pages:VariablesDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</UserControl>

View File

@@ -0,0 +1,24 @@
using System.Threading.Tasks;
using Avalonia.Controls;
using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages;
public partial class VariablesDemo : UserControl
{
public VariablesDemo()
{
InitializeComponent();
this.DataContext = new VariablesDemoViewModel();
}
public async Task Copy(object? o)
{
if (o is null) return;
var toplevel = TopLevel.GetTopLevel(this);
if (toplevel?.Clipboard is { } c)
{
await c.SetTextAsync(o.ToString());
}
}
}

View File

@@ -3,7 +3,6 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -11,25 +10,22 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia"/> <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.ColorPicker"/> <PackageReference Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<!-- <PackageReference Include="Avalonia.Controls.DataGrid"/>--> <PackageReference Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<!-- <PackageReference Include="Avalonia.Diagnostics">--> <PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)">
<!-- <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>--> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<!-- <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>--> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
<!-- </PackageReference>--> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm"/> <PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)"/>
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.3.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/> <ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/> <ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/>
<!-- <ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>--> <ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>
<!-- <ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>--> <ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>
</ItemGroup>
<ItemGroup>
<AvaloniaXaml Remove="Pages\VariablesDemo.axaml" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,7 +1,8 @@
<ResourceDictionary <ResourceDictionary
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:controls="clr-namespace:Semi.Avalonia.Demo.Controls"> xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
x:CompileBindings="True">
<ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl"> <ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="controls:ColorDetailControl"> <ControlTemplate TargetType="controls:ColorDetailControl">

View File

@@ -1,7 +1,8 @@
<ResourceDictionary <ResourceDictionary
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:controls="using:Semi.Avalonia.Demo.Controls"> xmlns:controls="using:Semi.Avalonia.Demo.Controls"
x:CompileBindings="True">
<Design.PreviewWith> <Design.PreviewWith>
<controls:ColorItemControl /> <controls:ColorItemControl />
</Design.PreviewWith> </Design.PreviewWith>

View File

@@ -0,0 +1,153 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
x:CompileBindings="True"
x:DataType="viewModels:FunctionalColorGroupViewModel">
<ControlTheme x:Key="{x:Type controls:FunctionalColorGroupControl}" TargetType="controls:FunctionalColorGroupControl">
<Setter Property="Template">
<ControlTemplate TargetType="controls:FunctionalColorGroupControl">
<Grid RowDefinitions="Auto, *">
<SelectableTextBlock
Grid.Row="0"
Margin="0,16,0,0"
Classes="H3"
Text="{TemplateBinding Title}"
Theme="{DynamicResource TitleSelectableTextBlock}" />
<TabControl Grid.Row="1">
<TabItem Header="Light">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightColors}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="70" Header="Color">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<controls:ColorItemControl
Width="40"
Height="20"
Background="{Binding Brush}"
CornerRadius="3" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="100" Header="Hex">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Hex}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="80" Header="Opacity">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Brush.Opacity}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Header="Dark">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkColors}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="70" Header="Color">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<controls:ColorItemControl
Width="40"
Height="20"
Background="{Binding Brush}"
CornerRadius="3" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="100" Header="Hex">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Hex}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="80" Header="Opacity">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Brush.Opacity}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</Grid>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -0,0 +1,111 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
x:CompileBindings="True"
x:DataType="viewModels:ShadowGroupViewModel">
<ControlTheme x:Key="{x:Type controls:ShadowGroupControl}" TargetType="controls:ShadowGroupControl">
<Setter Property="Template">
<ControlTemplate TargetType="controls:ShadowGroupControl">
<Grid RowDefinitions="Auto, *">
<SelectableTextBlock
Grid.Row="0"
Margin="0,16,0,0"
Classes="H3"
Text="{TemplateBinding Title}"
Theme="{DynamicResource TitleSelectableTextBlock}" />
<TabControl Grid.Row="1">
<TabItem Header="Light">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightShadows}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="BoxShadows">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ShadowItemViewModel"
Binding="{Binding ShadowDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Header="Dark">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkShadows}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="BoxShadows">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ShadowItemViewModel"
Binding="{Binding ShadowDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</Grid>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -2,6 +2,8 @@
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="ColorDetailControl.axaml" /> <ResourceInclude Source="ColorDetailControl.axaml" />
<ResourceInclude Source="ColorItemControl.axaml" /> <ResourceInclude Source="ColorItemControl.axaml" />
<ResourceInclude Source="FunctionalColorGroupControl.axaml" />
<ResourceInclude Source="ShadowGroupControl.axaml" />
<ResourceInclude Source="ToggleSwitch.axaml" /> <ResourceInclude Source="ToggleSwitch.axaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,37 +1,12 @@
using Avalonia; using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
namespace Semi.Avalonia.Demo.ViewModels; namespace Semi.Avalonia.Demo.ViewModels;
public partial class ApplicationViewModel : ObservableObject public partial class ApplicationViewModel : ObservableObject
{ {
[RelayCommand]
private void Activate()
{
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop) return;
var mainWindow = desktop.MainWindow;
if (mainWindow is not null && !mainWindow.IsActive)
{
if (mainWindow.WindowState is WindowState.Minimized)
{
mainWindow.WindowState = WindowState.Normal;
}
mainWindow.Activate();
}
}
[RelayCommand]
private void JumpTo(string header)
{
Activate();
WeakReferenceMessenger.Default.Send(header, "JumpTo");
}
[RelayCommand] [RelayCommand]
private void Exit() private void Exit()
{ {

View File

@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Collections;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Semi.Avalonia.Demo.ViewModels;
public class DataGridDemoViewModel : ObservableObject
{
public ObservableCollection<Song> GridData1 { get; set; }
public DataGridCollectionView GridData2 { get; set; }
public ObservableCollection<SongViewModel> GridData3 { get; set; }
public RelayCommand AddCommand { get; set; }
public DataGridDemoViewModel()
{
GridData1 = new ObservableCollection<Song>(Song.Songs);
GridData2 = new DataGridCollectionView(Song.Songs);
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a => new SongViewModel()
{
Title = a.Title,
Artist = a.Artist,
Album = a.Album,
CountOfComment = a.CountOfComment,
IsSelected = false
}));
AddCommand = new RelayCommand(Add);
}
private void Add()
{
GridData3.Add(new SongViewModel());
}
}
public class Song
{
public string? Title { get; set; }
public string? Artist { get; set; }
public TimeSpan? Duration { get; set; }
public string? Album { get; set; }
public int CountOfComment { get; set; }
public string Url { get; set; }
public Song(string title, string artist, int m, int s, string album, int countOfComment, int netEaseId)
{
Title = title;
Artist = artist;
Duration = new TimeSpan(0, m, s);
Album = album;
CountOfComment = countOfComment;
Url = $"https://music.163.com/song?id={netEaseId}";
}
public static List<string> Albums =>
[
"A.S.I.A",
"饕餮人间",
"七步咙咚呛",
"大惊小怪",
"The ONE",
"以梦为马 (壮志骄阳版)",
"emo了",
"一眼万年",
"冲刺吧",
"爱的赏味期限",
"COSMIC ANTHEM / 手紙",
"世界晚安",
"明年也要好好长大",
"320万年前",
"W.O.R.L.D."
];
public static List<Song> Songs =>
[
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
new("长大", "熊猫堂ProducePandas", 4, 6, "A.S.I.A", 1114, 1487037690),
new("招财猫(feat.纪粹希(G-Tracy))", "熊猫堂ProducePandas", 3, 37, "A.S.I.A", 361, 1487039632),
new("千转", "熊猫堂ProducePandas", 4, 0, "A.S.I.A", 1115, 1477312398),
new("辣辣辣", "熊猫堂ProducePandas", 3, 24, "A.S.I.A", 1873, 1465043716),
new("碎碎念", "熊猫堂ProducePandas", 3, 25, "A.S.I.A", 676, 1474142064),
new("盘他", "熊猫堂ProducePandas", 2, 16, "A.S.I.A", 365, 1481652786),
new("Na Na Na", "熊猫堂ProducePandas", 3, 26, "A.S.I.A", 312, 1469022662),
new("Indigo", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 137, 1487039517),
new("饕餮人间", "熊猫堂ProducePandas", 3, 20, "饕餮人间", 1295, 1499584605),
new("七步咙咚呛", "熊猫堂ProducePandas", 3, 10, "七步咙咚呛", 175, 1809095152),
new("大惊小怪", "熊猫堂ProducePandas", 3, 32, "大惊小怪", 10420, 1847477425),
new("工具人", "熊猫堂ProducePandas", 2, 46, "大惊小怪", 1135, 1847476499),
new("以梦为马", "熊猫堂ProducePandas", 4, 19, "大惊小怪", 18361, 1836034373),
new("以梦为马(Piano Version)", "熊猫堂ProducePandas", 3, 4, "大惊小怪", 570, 1847477423),
new("The ONE", "熊猫堂ProducePandas", 2, 58, "The ONE", 1508, 1864329424),
new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "The ONE", 385, 1864329429),
new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 19, "以梦为马 (壮志骄阳版)", 161, 1865138896),
new("New Horse", "熊猫堂ProducePandas", 2, 30, "emo了", 643, 1887021307),
new("不例外", "熊猫堂ProducePandas", 3, 31, "emo了", 1818, 1887022665),
new("满意", "熊猫堂ProducePandas", 4, 32, "emo了", 1081, 1882433472),
new("就算与全世界为敌也要跟你在一起", "熊猫堂ProducePandas", 3, 32, "emo了", 2119, 1881759960),
new("The ONE", "熊猫堂ProducePandas", 2, 58, "emo了", 67, 1887022648),
new("口香糖", "熊猫堂ProducePandas", 3, 10, "emo了", 2181, 1885502254),
new("Suuuuuuper Mario", "熊猫堂ProducePandas", 3, 32, "emo了", 1010, 1887021318),
new("饕餮人间", "熊猫堂ProducePandas", 3, 22, "emo了", 109, 1887021320),
new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 21, "emo了", 34, 1887022666),
new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "emo了", 27, 1887022646),
new("满意(DJheap九天版)", "熊猫堂ProducePandas", 4, 31, "emo了", 31, 1901605941),
new("一眼万年", "熊猫堂ProducePandas", 3, 54, "一眼万年", 20, 1922599361),
new("冲刺", "熊猫堂ProducePandas", 3, 49, "冲刺吧", 1006, 1932878194),
new("滴答滴", "熊猫堂ProducePandas", 2, 30, "爱的赏味期限", 86, 1957515790),
new("热带季风", "熊猫堂ProducePandas", 2, 45, "爱的赏味期限", 212, 1957514964),
new("渣", "熊猫堂ProducePandas", 3, 28, "爱的赏味期限", 22, 1957514965),
new("独特", "熊猫堂ProducePandas", 3, 33, "爱的赏味期限", 62, 1957514966),
new("雨后", "熊猫堂ProducePandas", 4, 15, "爱的赏味期限", 23, 1957514967),
new("然后然后", "熊猫堂ProducePandas", 3, 50, "爱的赏味期限", 108, 1957514968),
new("丢", "熊猫堂ProducePandas", 3, 26, "爱的赏味期限", 30, 1957515792),
new("热带疾风(FACEVOID桃心连哥 Remix)", "熊猫堂ProducePandas", 3, 23, "爱的赏味期限", 55, 1957515793),
new("COSMIC ANTHEM -Japanese Ver.-", "熊猫堂ProducePandas", 3, 11, "COSMIC ANTHEM / 手紙", 0, 1977171493),
new("手紙 (「長大-You Raise Me Up-」-Japanese Ver.-)", "熊猫堂ProducePandas", 4, 11, "COSMIC ANTHEM / 手紙", 0,
1977171494),
new("COSMIC ANTHEM -Chinese Ver.-", "熊猫堂ProducePandas", 3, 31, "COSMIC ANTHEM / 手紙", 0, 1977172202),
new("世界晚安", "熊猫堂ProducePandas", 2, 59, "世界晚安", 652, 1985063377),
new("世界晚安(泰文版)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 134, 1987842504),
new("世界晚安(钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 76, 1990475933),
new("世界晚安(泰文钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 29, 1990475934),
new("世界晚安(DJ沈念版)", "熊猫堂ProducePandas", 3, 9, "世界晚安", 34, 2014263184),
new("世界晚安(钢琴配乐)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 11, 2014263185),
new("明年也要好好长大", "熊猫堂ProducePandas", 3, 12, "明年也要好好长大", 0, 2010515162),
new("320万年前DJ沈念版", "熊猫堂ProducePandas", 3, 21, "320万年前", 8, 2055888636),
new("320万年前", "熊猫堂ProducePandas", 3, 7, "W.O.R.L.D.", 329, 2049770469),
new("隐德来希", "熊猫堂ProducePandas", 3, 3, "W.O.R.L.D.", 594, 2061317924),
new("孔明", "熊猫堂ProducePandas", 3, 59, "W.O.R.L.D.", 91, 2063175274),
new("锦鲤卟噜噜", "熊猫堂ProducePandas", 3, 5, "W.O.R.L.D.", 67, 2059208262),
new("指鹿为马", "熊猫堂ProducePandas", 3, 12, "W.O.R.L.D.", 74, 2063175272),
new("热带季风Remix", "熊猫堂ProducePandas", 3, 22, "W.O.R.L.D.", 23, 2063173319),
new("加州梦境", "熊猫堂ProducePandas", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775)
];
}
public partial class SongViewModel : ObservableObject
{
[ObservableProperty] private string? _title;
[ObservableProperty] private string? _artist;
[ObservableProperty] private string? _album;
[ObservableProperty] private int _countOfComment;
[ObservableProperty] private bool? _isSelected;
}

View File

@@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Avalonia.Controls; using Avalonia.Controls;
@@ -10,21 +9,20 @@ namespace Semi.Avalonia.Demo.ViewModels;
public partial class IconDemoViewModel : ObservableObject public partial class IconDemoViewModel : ObservableObject
{ {
private readonly Icons _resources = new(); private readonly IResourceDictionary? _resources = new Icons();
private readonly Dictionary<string, IconItem> _fillIcons = new(); private readonly Dictionary<string, IconItem> _filledIcons = new();
private readonly Dictionary<string, IconItem> _strokedIcons = new(); private readonly Dictionary<string, IconItem> _strokedIcons = new();
private readonly Dictionary<string, IconItem> _aiIcons = new();
[ObservableProperty] private string? _searchText; [ObservableProperty] private string? _searchText;
public ObservableCollection<IconTab> IconTabs { get; } = []; public ObservableCollection<IconItem> FilteredFilledIcons { get; set; } = [];
public ObservableCollection<IconItem> FilteredFillIcons { get; set; } = [];
public ObservableCollection<IconItem> FilteredStrokedIcons { get; set; } = []; public ObservableCollection<IconItem> FilteredStrokedIcons { get; set; } = [];
public ObservableCollection<IconItem> FilteredAIIcons { get; set; } = [];
public void InitializeResources() public void InitializeResources()
{ {
if (_resources is null) return;
foreach (var provider in _resources.MergedDictionaries) foreach (var provider in _resources.MergedDictionaries)
{ {
if (provider is not ResourceDictionary dic) continue; if (provider is not ResourceDictionary dic) continue;
@@ -32,60 +30,40 @@ public partial class IconDemoViewModel : ObservableObject
foreach (var key in dic.Keys) foreach (var key in dic.Keys)
{ {
if (dic[key] is not Geometry geometry) continue; if (dic[key] is not Geometry geometry) continue;
var resourceKey = key.ToString() ?? string.Empty;
var icon = new IconItem var icon = new IconItem
{ {
ResourceKey = resourceKey, ResourceKey = key.ToString(),
Geometry = geometry Geometry = geometry
}; };
if (resourceKey.StartsWith("SemiIconAI")) if (key.ToString().EndsWith("Stroked"))
_aiIcons[resourceKey] = icon; _strokedIcons[key.ToString().ToLowerInvariant()] = icon;
else if (resourceKey.EndsWith("Stroked", StringComparison.InvariantCultureIgnoreCase))
_strokedIcons[resourceKey] = icon;
else else
_fillIcons[resourceKey] = icon; _filledIcons[key.ToString().ToLowerInvariant()] = icon;
} }
} }
OnSearchTextChanged(string.Empty); OnSearchTextChanged(string.Empty);
IconTabs.Clear();
IconTabs.Add(new IconTab("Fill Icons", FilteredFillIcons));
IconTabs.Add(new IconTab("Stroked Icons", FilteredStrokedIcons));
IconTabs.Add(new IconTab("AI Icons", FilteredAIIcons));
} }
partial void OnSearchTextChanged(string? value) partial void OnSearchTextChanged(string? value)
{ {
var search = string.IsNullOrWhiteSpace(value) ? string.Empty : value.Trim(); var search = value?.ToLowerInvariant() ?? string.Empty;
FilteredFillIcons.Clear(); FilteredFilledIcons.Clear();
foreach (var pair in _fillIcons.Where(kv => kv.Key.Contains(search, StringComparison.InvariantCultureIgnoreCase))) foreach (var pair in _filledIcons.Where(i => i.Key.Contains(search)))
{ {
FilteredFillIcons.Add(pair.Value); FilteredFilledIcons.Add(pair.Value);
} }
FilteredStrokedIcons.Clear(); FilteredStrokedIcons.Clear();
foreach (var pair in _strokedIcons.Where(kv => kv.Key.Contains(search, StringComparison.InvariantCultureIgnoreCase))) foreach (var pair in _strokedIcons.Where(i => i.Key.Contains(search)))
{ {
FilteredStrokedIcons.Add(pair.Value); FilteredStrokedIcons.Add(pair.Value);
} }
FilteredAIIcons.Clear();
foreach (var pair in _aiIcons.Where(kv => kv.Key.Contains(search, StringComparison.InvariantCultureIgnoreCase)))
{
FilteredAIIcons.Add(pair.Value);
}
} }
} }
public class IconTab(string header, ObservableCollection<IconItem> iconItems)
{
public string Header { get; set; } = header;
public ObservableCollection<IconItem> IconItems { get; set; } = iconItems;
}
public class IconItem public class IconItem
{ {
public string? ResourceKey { get; set; } public string? ResourceKey { get; set; }

View File

@@ -19,7 +19,7 @@ public partial class PaletteDemoViewModel : ObservableObject
"Red", "Pink", "Purple", "Violet", "Indigo", "Red", "Pink", "Purple", "Violet", "Indigo",
"Blue", "LightBlue", "Cyan", "Teal", "Green", "Blue", "LightBlue", "Cyan", "Teal", "Green",
"LightGreen", "Lime", "Yellow", "Amber", "Orange", "LightGreen", "Lime", "Yellow", "Amber", "Orange",
"Grey", "AIPurple" "Grey"
]; ];
private readonly IResourceDictionary? _lightResourceDictionary; private readonly IResourceDictionary? _lightResourceDictionary;
@@ -61,38 +61,6 @@ public partial class PaletteDemoViewModel : ObservableObject
s.Initialize(_darkResourceDictionary, color, false); s.Initialize(_darkResourceDictionary, color, false);
DarkLists.Add(s); DarkLists.Add(s);
} }
InitializeAIGeneralGradients();
}
private void InitializeAIGeneralGradients()
{
if (_lightResourceDictionary is null || _darkResourceDictionary is null) return;
ColorListViewModel lightGradients = new ColorListViewModel { SeriesName = "AI General" };
ColorListViewModel darkGradients = new ColorListViewModel { SeriesName = "AI General" };
for (var i = 0; i < 10; i++)
{
var key = $"SemiAIGeneral{i}";
if (_lightResourceDictionary.TryGetValue(key, out var lightValue) && lightValue is IBrush lightBrush)
{
var name = $"AI General {i}";
var item = new ColorItemViewModel(name, lightBrush, key, true, i);
lightGradients.Color.Add(item);
}
if (_darkResourceDictionary.TryGetValue(key, out var darkValue) && darkValue is IBrush darkBrush)
{
var name = $"AI General {i}";
var item = new ColorItemViewModel(name, darkBrush, key, false, i);
darkGradients.Color.Add(item);
}
}
LightLists.Add(lightGradients);
DarkLists.Add(darkGradients);
} }
private void InitializeFunctionalColors() private void InitializeFunctionalColors()
@@ -111,12 +79,6 @@ public partial class PaletteDemoViewModel : ObservableObject
"Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens)); "Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel( FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Danger", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DangerTokens)); "Danger", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DangerTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"AI General", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.AIGeneralTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"AI Purple", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.AIPurpleTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"AI Background", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.AIBackgroundTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel( FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Text", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TextTokens)); "Text", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TextTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel( FunctionalColors.Add(new FunctionalColorGroupViewModel(
@@ -180,24 +142,14 @@ public partial class ColorItemViewModel : ObservableObject
<StaticResource x:Key="" ResourceKey="{ResourceKey}" /> <StaticResource x:Key="" ResourceKey="{ResourceKey}" />
"""; """;
public ColorItemViewModel(string colorDisplayName, IBrush brush, string resourceKey, bool light, public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
int index) int index)
{ {
ColorDisplayName = colorDisplayName; ColorDisplayName = colorDisplayName;
Brush = brush; Brush = brush;
ResourceKey = resourceKey; ResourceKey = resourceKey;
var hex = ColorConverter.ToHex.Convert(brush.Color, typeof(string), false, CultureInfo.InvariantCulture);
// Only calculate hex for solid color brushes Hex = hex as string ?? string.Empty;
if (brush is ISolidColorBrush solidBrush)
{
var hex = ColorConverter.ToHex.Convert(solidBrush.Color, typeof(string), false, CultureInfo.InvariantCulture);
Hex = hex as string ?? string.Empty;
}
else
{
Hex = string.Empty;
}
if ((light && index < 5) || (!light && index >= 5)) if ((light && index < 5) || (!light && index >= 5))
{ {
TextBrush = Brushes.Black; TextBrush = Brushes.Black;
@@ -223,7 +175,7 @@ public partial class FunctionalColorGroupViewModel : ObservableObject
{ {
if (lightDictionary?.TryGetValue(key, out var lightValue) ?? false) if (lightDictionary?.TryGetValue(key, out var lightValue) ?? false)
{ {
if (lightValue is IBrush lightBrush) if (lightValue is ISolidColorBrush lightBrush)
{ {
LightColors.Add(new ColorItemViewModel(name, lightBrush, key, true, 0)); LightColors.Add(new ColorItemViewModel(name, lightBrush, key, true, 0));
} }
@@ -231,7 +183,7 @@ public partial class FunctionalColorGroupViewModel : ObservableObject
if (darkDictionary?.TryGetValue(key, out var darkValue) ?? false) if (darkDictionary?.TryGetValue(key, out var darkValue) ?? false)
{ {
if (darkValue is IBrush darkBrush) if (darkValue is ISolidColorBrush darkBrush)
{ {
DarkColors.Add(new ColorItemViewModel(name, darkBrush, key, true, 0)); DarkColors.Add(new ColorItemViewModel(name, darkBrush, key, true, 0));
} }

View File

@@ -26,12 +26,4 @@ public class SplitViewDemoViewModel : ObservableObject
SplitViewDisplayMode.Overlay, SplitViewDisplayMode.Overlay,
SplitViewDisplayMode.CompactOverlay, SplitViewDisplayMode.CompactOverlay,
]; ];
public static ObservableCollection<SplitViewPanePlacement> Placements { get; set; } =
[
SplitViewPanePlacement.Left,
SplitViewPanePlacement.Right,
SplitViewPanePlacement.Top,
SplitViewPanePlacement.Bottom
];
} }

View File

@@ -0,0 +1,364 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Controls;
using Avalonia.Controls.Models.TreeDataGrid;
using Avalonia.Controls.Selection;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Semi.Avalonia.Demo.ViewModels;
public partial class FilesPageViewModel : ObservableObject
{
public IList<string> Drives { get; }
public HierarchicalTreeDataGridSource<FileNodeViewModel> Source { get; }
[ObservableProperty] private string _selectedDrive;
[ObservableProperty] private string? _selectedPath;
[ObservableProperty] private FileNodeViewModel? _root;
partial void OnSelectedDriveChanged(string value)
{
Root = new FileNodeViewModel(value, true, true);
if (Source is not null)
{
Source.Items = [Root];
}
}
partial void OnSelectedPathChanged(string? value)
{
SetSelectedPath(value);
}
public FilesPageViewModel()
{
Drives = DriveInfo.GetDrives().Select(x => x.Name).ToList();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
SelectedDrive = @"C:\";
}
else
{
SelectedDrive = Drives.FirstOrDefault() ?? "/";
}
Source = new HierarchicalTreeDataGridSource<FileNodeViewModel>(Array.Empty<FileNodeViewModel>())
{
Columns =
{
new CheckBoxColumn<FileNodeViewModel>(
null,
x => x.IsChecked,
(o, v) => o.IsChecked = v,
options: new CheckBoxColumnOptions<FileNodeViewModel>
{
CanUserResizeColumn = false,
}),
new HierarchicalExpanderColumn<FileNodeViewModel>(
new TemplateColumn<FileNodeViewModel>(
"Name",
"FileNameCell",
"FileNameEditCell",
new GridLength(1, GridUnitType.Star),
new TemplateColumnOptions<FileNodeViewModel>
{
CompareAscending = FileNodeViewModel.SortAscending(vm => vm.Name),
CompareDescending = FileNodeViewModel.SortDescending(vm => vm.Name),
IsTextSearchEnabled = true,
TextSearchValueSelector = vm => vm.Name
}),
vm => vm.Children,
vm => vm.HasChildren,
vm => vm.IsExpanded),
new TextColumn<FileNodeViewModel, long?>(
"Size",
vm => vm.Size,
options: new TextColumnOptions<FileNodeViewModel>
{
CompareAscending = FileNodeViewModel.SortAscending(x => x.Size),
CompareDescending = FileNodeViewModel.SortDescending(x => x.Size),
}),
new TextColumn<FileNodeViewModel, DateTimeOffset?>(
"Modified",
x => x.Modified,
options: new TextColumnOptions<FileNodeViewModel>
{
CompareAscending = FileNodeViewModel.SortAscending(x => x.Modified),
CompareDescending = FileNodeViewModel.SortDescending(x => x.Modified),
}),
}
};
Source.RowSelection!.SingleSelect = false;
Source.RowSelection.SelectionChanged += SelectionChanged;
}
private void SelectionChanged(object? sender, TreeSelectionModelSelectionChangedEventArgs<FileNodeViewModel> e)
{
var selectedPath = Source.RowSelection?.SelectedItem?.Path;
this.SetProperty(ref _selectedPath, selectedPath, nameof(SelectedPath));
foreach (var i in e.DeselectedItems)
Trace.WriteLine($"Deselected '{i?.Path}'");
foreach (var i in e.SelectedItems)
Trace.WriteLine($"Selected '{i?.Path}'");
}
private void SetSelectedPath(string? value)
{
if (string.IsNullOrEmpty(value))
{
Source.RowSelection!.Clear();
return;
}
var path = value;
var components = new Stack<string>();
DirectoryInfo? d = null;
if (File.Exists(path))
{
var f = new FileInfo(path);
components.Push(f.Name);
d = f.Directory;
}
else if (Directory.Exists(path))
{
d = new DirectoryInfo(path);
}
while (d is not null)
{
components.Push(d.Name);
d = d.Parent;
}
var index = IndexPath.Unselected;
if (components.Count > 0)
{
var drive = components.Pop();
var driveIndex = Drives.FindIndex(x => string.Equals(x, drive, StringComparison.OrdinalIgnoreCase));
if (driveIndex >= 0)
SelectedDrive = Drives[driveIndex];
FileNodeViewModel? node = _root;
index = new IndexPath(0);
while (node is not null && components.Count > 0)
{
node.IsExpanded = true;
var component = components.Pop();
var i = node.Children.FindIndex(x => string.Equals(x.Name, component, StringComparison.OrdinalIgnoreCase));
node = i >= 0 ? node.Children[i] : null;
index = i >= 0 ? index.Append(i) : default;
}
}
Source.Items = [Root];
Source.RowSelection!.SelectedIndex = index;
}
}
public partial class FileNodeViewModel : ObservableObject, IEditableObject
{
[ObservableProperty] private string _path;
[ObservableProperty] private string _name;
private string? _undoName;
[ObservableProperty] private long? _size;
[ObservableProperty] private DateTimeOffset? _modified;
private FileSystemWatcher? _watcher;
private ObservableCollection<FileNodeViewModel>? _children;
[ObservableProperty] private bool _hasChildren = true;
[ObservableProperty] private bool _isExpanded;
public FileNodeViewModel(string path, bool isDirectory, bool isRoot = false)
{
Path = path;
Name = isRoot ? path : System.IO.Path.GetFileName(Path);
IsExpanded = isRoot;
IsDirectory = isDirectory;
HasChildren = isDirectory;
if (!isDirectory)
{
var info = new FileInfo(path);
Size = info.Length;
Modified = info.LastWriteTimeUtc;
}
}
public bool IsChecked { get; set; }
public bool IsDirectory { get; }
public IReadOnlyList<FileNodeViewModel> Children => _children ??= LoadChildren();
private ObservableCollection<FileNodeViewModel> LoadChildren()
{
if (!IsDirectory)
{
throw new NotSupportedException();
}
var options = new EnumerationOptions { IgnoreInaccessible = true };
var result = new ObservableCollection<FileNodeViewModel>();
foreach (var d in Directory.EnumerateDirectories(Path, "*", options))
{
result.Add(new FileNodeViewModel(d, true));
}
foreach (var f in Directory.EnumerateFiles(Path, "*", options))
{
result.Add(new FileNodeViewModel(f, false));
}
_watcher = new FileSystemWatcher
{
Path = Path,
NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite,
};
_watcher.Changed += OnChanged;
_watcher.Created += OnCreated;
_watcher.Deleted += OnDeleted;
_watcher.Renamed += OnRenamed;
_watcher.EnableRaisingEvents = true;
if (result.Count == 0)
HasChildren = false;
return result;
}
public static Comparison<FileNodeViewModel?> SortAscending<T>(Func<FileNodeViewModel, T> selector)
{
return (x, y) =>
{
if (x is null && y is null)
return 0;
else if (x is null)
return -1;
else if (y is null)
return 1;
if (x.IsDirectory == y.IsDirectory)
return Comparer<T>.Default.Compare(selector(x), selector(y));
else if (x.IsDirectory)
return -1;
else
return 1;
};
}
public static Comparison<FileNodeViewModel?> SortDescending<T>(Func<FileNodeViewModel, T> selector)
{
return (x, y) =>
{
if (x is null && y is null)
return 0;
else if (x is null)
return 1;
else if (y is null)
return -1;
if (x.IsDirectory == y.IsDirectory)
return Comparer<T>.Default.Compare(selector(y), selector(x));
else if (x.IsDirectory)
return -1;
else
return 1;
};
}
void IEditableObject.BeginEdit() => _undoName = _name;
void IEditableObject.CancelEdit() => _name = _undoName!;
void IEditableObject.EndEdit() => _undoName = null;
private void OnChanged(object sender, FileSystemEventArgs e)
{
if (e.ChangeType == WatcherChangeTypes.Changed && File.Exists(e.FullPath))
{
Dispatcher.UIThread.Post(() =>
{
foreach (var child in _children!)
{
if (child.Path == e.FullPath)
{
if (!child.IsDirectory)
{
var info = new FileInfo(e.FullPath);
child.Size = info.Length;
child.Modified = info.LastWriteTimeUtc;
}
break;
}
}
});
}
}
private void OnCreated(object sender, FileSystemEventArgs e)
{
Dispatcher.UIThread.Post(() =>
{
var node = new FileNodeViewModel(
e.FullPath,
File.GetAttributes(e.FullPath).HasFlag(FileAttributes.Directory));
_children!.Add(node);
});
}
private void OnDeleted(object sender, FileSystemEventArgs e)
{
Dispatcher.UIThread.Post(() =>
{
for (var i = 0; i < _children!.Count; ++i)
{
if (_children[i].Path == e.FullPath)
{
_children.RemoveAt(i);
Debug.WriteLine($"Removed {e.FullPath}");
break;
}
}
});
}
private void OnRenamed(object sender, RenamedEventArgs e)
{
Dispatcher.UIThread.Post(() =>
{
foreach (var child in _children!)
{
if (child.Path == e.OldFullPath)
{
child.Path = e.FullPath;
child.Name = e.Name ?? string.Empty;
break;
}
}
});
}
}
internal static class ListExtensions
{
public static int FindIndex<T>(this IEnumerable<T> source, Func<T, bool> predicate)
{
int i = 0;
foreach (var item in source)
{
if (predicate(item))
return i;
i++;
}
return -1;
}
}

View File

@@ -0,0 +1,54 @@
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Models.TreeDataGrid;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Semi.Avalonia.Demo.ViewModels;
public class SongsPageViewModel : ObservableObject
{
public FlatTreeDataGridSource<SongViewModel> Songs { get; }
public SongsPageViewModel()
{
var songs = new ObservableCollection<SongViewModel>(Song.Songs.Select(a => new SongViewModel()
{
Title = a.Title,
Artist = a.Artist,
Album = a.Album,
CountOfComment = a.CountOfComment,
IsSelected = false
}));
Songs = new FlatTreeDataGridSource<SongViewModel>(songs)
{
Columns =
{
new CheckBoxColumn<SongViewModel>(
"IsSelected",
a => a.IsSelected,
(model, b) => { model.IsSelected = b; },
new GridLength(108, GridUnitType.Pixel)),
new TextColumn<SongViewModel, string>(
"Title",
a => a.Title,
(o, a) => o.Title = a,
new GridLength(6, GridUnitType.Star)),
new TextColumn<SongViewModel, string>("Artist",
a => a.Artist,
(o, a) => o.Artist = a,
new GridLength(6, GridUnitType.Star)),
new TemplateColumn<SongViewModel>("Album",
"AlbumCell",
"AlbumEditCell",
new GridLength(6, GridUnitType.Star)),
new TemplateColumn<SongViewModel>(
"Comments",
"CommentsCell",
"CommentsEditCell",
new GridLength(6, GridUnitType.Star)),
}
};
}
}

View File

@@ -0,0 +1,9 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace Semi.Avalonia.Demo.ViewModels;
public class TreeDataGridDemoViewModel : ObservableObject
{
public SongsPageViewModel SongsContext { get; } = new();
public FilesPageViewModel FilesContext { get; } = new();
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using Semi.Avalonia.Tokens;
namespace Semi.Avalonia.Demo.ViewModels;
public class VariablesDemoViewModel : ObservableObject
{
public DataGridCollectionView GridData { get; set; }
public VariablesDemoViewModel()
{
IResourceDictionary dictionary = new Variables();
foreach (var token in Tokens)
{
if (token.ResourceKey is not null && dictionary.TryGetValue(token.ResourceKey, out var value))
{
token.Type = value?.GetType();
token.Value = GetValueString(value);
}
}
GridData = new DataGridCollectionView(Tokens);
GridData.GroupDescriptions.Add(new DataGridPathGroupDescription(nameof(VariableItem.Category)));
}
private static string GetValueString(object? value)
{
if (value is null) return string.Empty;
return value switch
{
double d => d.ToString(CultureInfo.InvariantCulture),
CornerRadius c => c.IsUniform ? $"{c.TopLeft}" : c.ToString(),
Thickness t => t.IsUniform ? $"{t.Left}" : t.ToString(),
FontWeight fontWeight => Convert.ToInt32(fontWeight).ToString(),
FontFamily fontFamily => fontFamily.FamilyNames.ToString(),
_ => value.ToString()
};
}
private static List<VariableItem> Tokens { get; set; } =
[
new("Height", "SemiHeightControlSmall"),
new("Height", "SemiHeightControlDefault"),
new("Height", "SemiHeightControlLarge"),
new("Icon Size", "SemiWidthIconExtraSmall"),
new("Icon Size", "SemiWidthIconSmall"),
new("Icon Size", "SemiWidthIconMedium"),
new("Icon Size", "SemiWidthIconLarge"),
new("Icon Size", "SemiWidthIconExtraLarge"),
new("Border CornerRadius", "SemiBorderRadiusExtraSmall"),
new("Border CornerRadius", "SemiBorderRadiusSmall"),
new("Border CornerRadius", "SemiBorderRadiusMedium"),
new("Border CornerRadius", "SemiBorderRadiusLarge"),
new("Border CornerRadius", "SemiBorderRadiusFull"),
new("Border Spacing", "SemiBorderSpacing"),
new("Border Spacing", "SemiBorderSpacingControl"),
new("Border Spacing", "SemiBorderSpacingControlFocus"),
new("Border Thickness", "SemiBorderThickness"),
new("Border Thickness", "SemiBorderThicknessControl"),
new("Border Thickness", "SemiBorderThicknessControlFocus"),
new("Spacing", "SemiSpacingNone"),
new("Spacing", "SemiSpacingSuperTight"),
new("Spacing", "SemiSpacingExtraTight"),
new("Spacing", "SemiSpacingTight"),
new("Spacing", "SemiSpacingBaseTight"),
new("Spacing", "SemiSpacingBase"),
new("Spacing", "SemiSpacingBaseLoose"),
new("Spacing", "SemiSpacingLoose"),
new("Spacing", "SemiSpacingExtraLoose"),
new("Spacing", "SemiSpacingSuperLoose"),
new("Thickness", "SemiThicknessNone"),
new("Thickness", "SemiThicknessSuperTight"),
new("Thickness", "SemiThicknessExtraTight"),
new("Thickness", "SemiThicknessTight"),
new("Thickness", "SemiThicknessBaseTight"),
new("Thickness", "SemiThicknessBase"),
new("Thickness", "SemiThicknessBaseLoose"),
new("Thickness", "SemiThicknessLoose"),
new("Thickness", "SemiThicknessExtraLoose"),
new("Thickness", "SemiThicknessSuperLoose"),
new("FontSize", "SemiFontSizeSmall"),
new("FontSize", "SemiFontSizeRegular"),
new("FontSize", "SemiFontSizeHeader6"),
new("FontSize", "SemiFontSizeHeader5"),
new("FontSize", "SemiFontSizeHeader4"),
new("FontSize", "SemiFontSizeHeader3"),
new("FontSize", "SemiFontSizeHeader2"),
new("FontSize", "SemiFontSizeHeader1"),
new("FontWeight", "SemiFontWeightLight"),
new("FontWeight", "SemiFontWeightRegular"),
new("FontWeight", "SemiFontWeightBold"),
new("FontFamily", "SemiFontFamilyRegular"),
];
}
public class VariableItem()
{
public string? Category { get; set; }
public string? ResourceKey { get; set; }
public Type? Type { get; set; }
public string? Value { get; set; }
public string? Description { get; set; }
public VariableItem(string category, string resourceKey, string description = "") : this()
{
Category = category;
ResourceKey = resourceKey;
Description = description;
}
public string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
}

View File

@@ -8,6 +8,7 @@
xmlns:views="clr-namespace:Semi.Avalonia.Demo.Views" xmlns:views="clr-namespace:Semi.Avalonia.Demo.Views"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="views:MainViewModel" x:DataType="views:MainViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>
@@ -116,15 +117,15 @@
<TabItem <TabItem
Theme="{DynamicResource CategoryTabItem}" Theme="{DynamicResource CategoryTabItem}"
Header="Resource Browser" /> Header="Resource Browser" />
<!-- <TabItem Header="Palette"> --> <TabItem Header="Palette">
<!-- <pages:PaletteDemo /> --> <pages:PaletteDemo />
<!-- </TabItem> --> </TabItem>
<!-- <TabItem Header="HighContrastTheme"> --> <TabItem Header="HighContrastTheme">
<!-- <pages:HighContrastDemo /> --> <pages:HighContrastDemo />
<!-- </TabItem> --> </TabItem>
<!-- <TabItem Header="Variables"> --> <TabItem Header="Variables">
<!-- <pages:VariablesDemo /> --> <pages:VariablesDemo />
<!-- </TabItem> --> </TabItem>
<TabItem Header="Icon"> <TabItem Header="Icon">
<pages:IconDemo /> <pages:IconDemo />
</TabItem> </TabItem>
@@ -134,12 +135,12 @@
<TabItem Header="ColorPicker"> <TabItem Header="ColorPicker">
<pages:ColorPickerDemo /> <pages:ColorPickerDemo />
</TabItem> </TabItem>
<!-- <TabItem Header="DataGrid"> --> <TabItem Header="DataGrid">
<!-- <pages:DataGridDemo /> --> <pages:DataGridDemo />
<!-- </TabItem> --> </TabItem>
<!-- <TabItem Header="TreeDataGrid"> --> <TabItem Header="TreeDataGrid">
<!-- <pages:TreeDataGridDemo /> --> <pages:TreeDataGridDemo />
<!-- </TabItem> --> </TabItem>
<TabItem <TabItem
Theme="{DynamicResource CategoryTabItem}" Theme="{DynamicResource CategoryTabItem}"
Header="Basic" /> Header="Basic" />
@@ -161,9 +162,15 @@
<TabItem Header="Button"> <TabItem Header="Button">
<pages:ButtonDemo /> <pages:ButtonDemo />
</TabItem> </TabItem>
<TabItem Header="RepeatButton">
<pages:RepeatButtonDemo />
</TabItem>
<TabItem Header="HyperlinkButton"> <TabItem Header="HyperlinkButton">
<pages:HyperlinkButtonDemo /> <pages:HyperlinkButtonDemo />
</TabItem> </TabItem>
<TabItem Header="ToggleButton">
<pages:ToggleButtonDemo />
</TabItem>
<TabItem Header="CheckBox"> <TabItem Header="CheckBox">
<pages:CheckBoxDemo /> <pages:CheckBoxDemo />
</TabItem> </TabItem>

View File

@@ -9,7 +9,6 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Styling; using Avalonia.Styling;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
namespace Semi.Avalonia.Demo.Views; namespace Semi.Avalonia.Demo.Views;
@@ -19,19 +18,6 @@ public partial class MainView : UserControl
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new MainViewModel(); this.DataContext = new MainViewModel();
WeakReferenceMessenger.Default.Register<string, string>(this, "JumpTo", MessageHandler);
}
private void MessageHandler(object _, string message)
{
foreach (var item in tab.ItemsView)
{
if (item is TabItem tabItem && tabItem.Header is not null && tabItem.Header.Equals(message))
{
tab.SelectedItem = tabItem;
break;
}
}
} }
} }
@@ -90,97 +76,61 @@ public partial class MainViewModel : ObservableObject
{ {
Header = "简体中文", Header = "简体中文",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("zh-CN") CommandParameter = new CultureInfo("zh-cn")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "English", Header = "English",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("en-US") CommandParameter = new CultureInfo("en-us")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "日本語", Header = "日本語",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("ja-JP") CommandParameter = new CultureInfo("ja-jp")
},
new MenuItemViewModel
{
Header = "한국어",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("ko-KR")
},
new MenuItemViewModel
{
Header = "English (UK)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("en-GB")
},
new MenuItemViewModel
{
Header = "Italiano",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("it-IT")
},
new MenuItemViewModel
{
Header = "Italiano (Switzerland)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("it-CH")
},
new MenuItemViewModel
{
Header = "Nederlands",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("nl-NL")
},
new MenuItemViewModel
{
Header = "Nederlands (Belgium)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("nl-BE")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Українська", Header = "Українська",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("uk-UA") CommandParameter = new CultureInfo("uk-ua")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Русский", Header = "Русский",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("ru-RU") CommandParameter = new CultureInfo("ru-ru")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "繁體中文", Header = "繁體中文",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("zh-TW") CommandParameter = new CultureInfo("zh-tw")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Deutsch", Header = "Deutsch",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("de-DE") CommandParameter = new CultureInfo("de-de")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Español", Header = "Español",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("es-ES") CommandParameter = new CultureInfo("es-es")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Polski", Header = "Polski",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("pl-PL") CommandParameter = new CultureInfo("pl-pl")
}, },
new MenuItemViewModel new MenuItemViewModel
{ {
Header = "Français", Header = "Français",
Command = SelectLocaleCommand, Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("fr-FR") CommandParameter = new CultureInfo("fr-fr")
}, },
] ]
} }
@@ -247,4 +197,4 @@ public class MenuItemViewModel
public ICommand? Command { get; set; } public ICommand? Command { get; set; }
public object? CommandParameter { get; set; } public object? CommandParameter { get; set; }
public IList<MenuItemViewModel>? Items { get; set; } public IList<MenuItemViewModel>? Items { get; set; }
} }

View File

@@ -1,14 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0-preview2</AvaloniaVersion>
<DataGridVersion>11.3.7</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0-preview1"/>
</ItemGroup>
</Project>

View File

@@ -1,23 +1,16 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> <Version>11.2.1.9</Version>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<PropertyGroup>
<Authors>IRIHI Technology Co., Ltd.</Authors> <Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description> <Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl> <RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon> <PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl> <PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile> <AvaloniaVersion>11.2.1</AvaloniaVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,8 +1,9 @@
<ResourceDictionary <ResourceDictionary
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:iri="https://irihi.tech/shared" xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:converters="using:Avalonia.Controls.Converters"> x:CompileBindings="True">
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<converters:ToBrushConverter x:Key="ToBrushConverter" /> <converters:ToBrushConverter x:Key="ToBrushConverter" />
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker"> <ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
@@ -16,11 +17,11 @@
<Border <Border
Margin="1,1,0,1" Margin="1,1,0,1"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}" Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" /> CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
<Border <Border
Margin="1,1,0,1" Margin="1,1,0,1"
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}" Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" /> CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
</Panel> </Panel>
</Template> </Template>
</Setter> </Setter>

View File

@@ -1,9 +1,12 @@
<ResourceDictionary <ResourceDictionary
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:iri="https://irihi.tech/shared" xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"> xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
x:CompileBindings="True">
<pc:AccentColorConverter x:Key="AccentColorConverter" /> <pc:AccentColorConverter x:Key="AccentColorConverter" />
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight" />
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer"> <ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" /> <Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
@@ -32,7 +35,7 @@
Background="{TemplateBinding HsvColor, Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter}, Converter={StaticResource AccentColorConverter},
ConverterParameter='-2'}" ConverterParameter='-2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Left}}" CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource LeftCornerRadiusFilterConverter}}"
Tag="-2" /> Tag="-2" />
<Border <Border
Name="PART_AccentDecrement1Border" Name="PART_AccentDecrement1Border"
@@ -68,7 +71,7 @@
Background="{TemplateBinding HsvColor, Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter}, Converter={StaticResource AccentColorConverter},
ConverterParameter='2'}" ConverterParameter='2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Right}}" CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource RightCornerRadiusFilterConverter}}"
Tag="2" /> Tag="2" />
</Grid> </Grid>
<!-- Preview color: Must be last for drop shadow Z-index --> <!-- Preview color: Must be last for drop shadow Z-index -->

View File

@@ -1,7 +1,8 @@
<ResourceDictionary <ResourceDictionary
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:converters="using:Avalonia.Controls.Converters"> xmlns:converters="using:Avalonia.Controls.Converters"
x:CompileBindings="True">
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" /> <converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" /> <converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />

View File

@@ -1,7 +1,8 @@
<ResourceDictionary <ResourceDictionary
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:converters="using:Avalonia.Controls.Converters"> xmlns:converters="using:Avalonia.Controls.Converters"
x:CompileBindings="True">
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" /> <converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" /> <converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" /> <converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />

View File

@@ -4,7 +4,8 @@
xmlns:converters="using:Avalonia.Controls.Converters" xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:globalization="using:System.Globalization" xmlns:globalization="using:System.Globalization"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters" xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters"> xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters"
x:CompileBindings="True">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" /> <pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" /> <converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
<converters:ColorToHexConverter x:Key="ColorToHexConverter" /> <converters:ColorToHexConverter x:Key="ColorToHexConverter" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary <ResourceDictionary
x:CompileBindings="True"
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">
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -1,50 +0,0 @@
# Semi.Avalonia.ColorPicker
[![Semi Avalonia ColorPicker](https://img.shields.io/nuget/v/Semi.Avalonia.ColorPicker.svg?color=red&style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.ColorPicker/)
[![Semi Avalonia ColorPicker](https://img.shields.io/nuget/dt/Semi.Avalonia.ColorPicker.svg?style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.ColorPicker/)
Avalonia ColorPicker Theme inspired by Semi Design
This package provides Semi Design theming for the Avalonia ColorPicker control.
## Installation
```bash
dotnet add package Semi.Avalonia.ColorPicker
```
## Prerequisites
This package requires the main Semi.Avalonia theme to be installed:
```bash
dotnet add package Semi.Avalonia
```
## Usage
Include the ColorPicker theme in your application:
```xaml
<Application
...
xmlns:semi="https://irihi.tech/semi">
<Application.Styles>
<semi:SemiTheme Locale="zh-CN" />
<semi:ColorPickerSemiTheme />
</Application.Styles>
</Application>
```
## Resources
- [Documentation](https://docs.irihi.tech/semi/)
- [Repository](https://github.com/irihitech/Semi.Avalonia)
- [Online Demo](https://irihitech.github.io/Semi.Avalonia/)
- [Download Demo](https://github.com/irihitech/Semi.Avalonia/releases)
## Credits
[Semi Design](https://semi.design/)
[Avalonia](https://github.com/AvaloniaUI/Avalonia)

View File

@@ -1,16 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Package.props"/>
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-preview1</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0-preview1</PackageReleaseNotes>
<Title>Semi.Avalonia.ColorPicker</Title> <Title>Semi.Avalonia.ColorPicker</Title>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.2.1.9</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Controls.ColorPicker"/> <PackageReference Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Irihi.Avalonia.Shared"/>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,7 +1,6 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Utilities; using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker; namespace Semi.Avalonia.ColorPicker;
@@ -221,8 +220,8 @@ public class SemiColorDarkPalette: IColorPalette
public Color GetColor(int colorIndex, int shadeIndex) public Color GetColor(int colorIndex, int shadeIndex)
{ {
return Colors[ return Colors[
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1), MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1) MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
]; ];
} }

View File

@@ -1,7 +1,6 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Utilities; using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker; namespace Semi.Avalonia.ColorPicker;
@@ -221,8 +220,8 @@ public class SemiColorLightPalette: IColorPalette
public Color GetColor(int colorIndex, int shadeIndex) public Color GetColor(int colorIndex, int shadeIndex)
{ {
return Colors[ return Colors[
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1), MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1) MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
]; ];
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -86,7 +86,7 @@
<Rectangle <Rectangle
Name="PART_RightGridLine" Name="PART_RightGridLine"
Grid.Column="1" Grid.Column="1"
Width="{DynamicResource DataGridGridLineThickness}" Width="1"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Fill="{DynamicResource DataGridLineBrush}" /> Fill="{DynamicResource DataGridLineBrush}" />
</Grid> </Grid>
@@ -145,7 +145,7 @@
<Rectangle <Rectangle
Name="VerticalSeparator" Name="VerticalSeparator"
Grid.Column="1" Grid.Column="1"
Width="{DynamicResource DataGridGridLineThickness}" Width="1"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Fill="{TemplateBinding SeparatorBrush}" Fill="{TemplateBinding SeparatorBrush}"
IsVisible="{TemplateBinding AreSeparatorsVisible}" /> IsVisible="{TemplateBinding AreSeparatorsVisible}" />
@@ -209,7 +209,7 @@
<Rectangle <Rectangle
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="2" Grid.RowSpan="2"
Height="{DynamicResource DataGridGridLineThickness}" Height="1"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Fill="{DynamicResource DataGridLineBrush}" Fill="{DynamicResource DataGridLineBrush}"
StrokeThickness="1" /> StrokeThickness="1" />
@@ -250,7 +250,7 @@
Grid.Row="2" Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Height="{DynamicResource DataGridGridLineThickness}" Height="1"
Margin="1,0,1,0" Margin="1,0,1,0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Fill="{TemplateBinding SeparatorBrush}" Fill="{TemplateBinding SeparatorBrush}"
@@ -315,7 +315,7 @@
Name="PART_BottomGridLine" Name="PART_BottomGridLine"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Height="{DynamicResource DataGridGridLineThickness}" Height="1"
HorizontalAlignment="Stretch" /> HorizontalAlignment="Stretch" />
</DataGridFrozenGrid> </DataGridFrozenGrid>
</Border> </Border>
@@ -452,7 +452,7 @@
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="5" Grid.ColumnSpan="5"
Height="{DynamicResource DataGridGridLineThickness}" Height="1"
Fill="{DynamicResource DataGridLineBrush}" /> Fill="{DynamicResource DataGridLineBrush}" />
</DataGridFrozenGrid> </DataGridFrozenGrid>
</ControlTemplate> </ControlTemplate>
@@ -498,7 +498,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
Height="{DynamicResource DataGridGridLineThickness}" Height="1"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Fill="{DynamicResource DataGridLineBrush}" /> Fill="{DynamicResource DataGridLineBrush}" />

View File

@@ -1,50 +0,0 @@
# Semi.Avalonia.DataGrid
[![Semi Avalonia DataGrid](https://img.shields.io/nuget/v/Semi.Avalonia.DataGrid.svg?color=red&style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.DataGrid/)
[![Semi Avalonia DataGrid](https://img.shields.io/nuget/dt/Semi.Avalonia.DataGrid.svg?style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.DataGrid/)
Avalonia DataGrid Theme inspired by Semi Design
This package provides Semi Design theming for the Avalonia DataGrid control.
## Installation
```bash
dotnet add package Semi.Avalonia.DataGrid
```
## Prerequisites
This package requires the main Semi.Avalonia theme to be installed:
```bash
dotnet add package Semi.Avalonia
```
## Usage
Include the DataGrid theme in your application:
```xaml
<Application
...
xmlns:semi="https://irihi.tech/semi">
<Application.Styles>
<semi:SemiTheme Locale="zh-CN" />
<semi:DataGridSemiTheme />
</Application.Styles>
</Application>
```
## Resources
- [Documentation](https://docs.irihi.tech/semi/)
- [Repository](https://github.com/irihitech/Semi.Avalonia)
- [Online Demo](https://irihitech.github.io/Semi.Avalonia/)
- [Download Demo](https://github.com/irihitech/Semi.Avalonia/releases)
## Credits
[Semi Design](https://semi.design/)
[Avalonia](https://github.com/AvaloniaUI/Avalonia)

View File

@@ -2,14 +2,27 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Version>11.3.7.3</Version> <Nullable>enable</Nullable>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.3.7.3</PackageReleaseNotes> <LangVersion>latest</LangVersion>
<Version>11.2.1.9</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.2.1.9</PackageReleaseNotes>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<Title>Semi.Avalonia.DataGrid</Title> <Title>Semi.Avalonia.DataGrid</Title>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Controls.DataGrid"/> <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.1"/>
<None Include="README.md" Pack="true" PackagePath="\"/> <None Include="..\..\irihi.png" Pack="true" PackagePath="\" Link="Properties\irihi.png"/>
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" Link="Properties\LICENSE"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -19,7 +19,4 @@
<StaticResource x:Key="DataGridRowGroupHeaderVisualStrokeThickness" ResourceKey="SemiBorderSpacingControl" /> <StaticResource x:Key="DataGridRowGroupHeaderVisualStrokeThickness" ResourceKey="SemiBorderSpacingControl" />
<StaticResource x:Key="DataGridDisabledCornerRadius" ResourceKey="SemiBorderRadiusSmall" /> <StaticResource x:Key="DataGridDisabledCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<!-- Grid line thickness -->
<x:Double x:Key="DataGridGridLineThickness">1</x:Double>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,10 +1,10 @@
<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="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" /> <StaticResource x:Key="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="TreeDataGridHeaderPointeroverBackground" ResourceKey="SemiColorFill1" /> <StaticResource x:Key="TreeDataGridHeaderPointerOverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" /> <StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointeroverBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" />
<StaticResource x:Key="TreeDataGridHeaderPointeroverForeground" ResourceKey="SemiColorText1" /> <StaticResource x:Key="TreeDataGridHeaderPointerOverForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" /> <StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" /> <StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" /> <StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />

View File

@@ -1,10 +1,10 @@
<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="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" /> <StaticResource x:Key="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="TreeDataGridHeaderPointeroverBackground" ResourceKey="SemiColorFill1" /> <StaticResource x:Key="TreeDataGridHeaderPointerOverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" /> <StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointeroverBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" />
<StaticResource x:Key="TreeDataGridHeaderPointeroverForeground" ResourceKey="SemiColorText1" /> <StaticResource x:Key="TreeDataGridHeaderPointerOverForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" /> <StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" /> <StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" /> <StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />

View File

@@ -1,50 +0,0 @@
# Semi.Avalonia.TreeDataGrid
[![Semi Avalonia TreeDataGrid](https://img.shields.io/nuget/v/Semi.Avalonia.TreeDataGrid.svg?color=red&style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.TreeDataGrid/)
[![Semi Avalonia TreeDataGrid](https://img.shields.io/nuget/dt/Semi.Avalonia.TreeDataGrid.svg?style=flat-square)](https://www.nuget.org/packages/Semi.Avalonia.TreeDataGrid/)
Avalonia TreeDataGrid Theme inspired by Semi Design
This package provides Semi Design theming for the Avalonia TreeDataGrid control.
## Installation
```bash
dotnet add package Semi.Avalonia.TreeDataGrid
```
## Prerequisites
This package requires the main Semi.Avalonia theme to be installed:
```bash
dotnet add package Semi.Avalonia
```
## Usage
Include the TreeDataGrid theme in your application:
```xaml
<Application
...
xmlns:semi="https://irihi.tech/semi">
<Application.Styles>
<semi:SemiTheme Locale="zh-CN" />
<semi:TreeDataGridSemiTheme />
</Application.Styles>
</Application>
```
## Resources
- [Documentation](https://docs.irihi.tech/semi/)
- [Repository](https://github.com/irihitech/Semi.Avalonia)
- [Online Demo](https://irihitech.github.io/Semi.Avalonia/)
- [Download Demo](https://github.com/irihitech/Semi.Avalonia/releases)
## Credits
[Semi Design](https://semi.design/)
[Avalonia](https://github.com/AvaloniaUI/Avalonia)

View File

@@ -2,14 +2,26 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>11.1.1.1</Version> <Nullable>enable</Nullable>
<PackageReleaseNotes>Update to Semi.Avalonia.TreeDataGrid 11.1.1.1</PackageReleaseNotes> <LangVersion>latest</LangVersion>
<Title>Semi.Avalonia.TreeDataGrid</Title> <Version>11.0.10.4</Version>
<PackageReleaseNotes>Update to 11.0.10.4</PackageReleaseNotes>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Controls.TreeDataGrid"/> <PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10"/>
<None Include="README.md" Pack="true" PackagePath="\"/> <None Include="..\..\irihi.png" Pack="true" PackagePath="\" Link="Properties\irihi.png"/>
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" Link="Properties\LICENSE"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,8 +1,7 @@
<ResourceDictionary <ResourceDictionary
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:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls.TreeDataGrid" xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls.TreeDataGrid">
x:CompileBindings="True">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Margin="20"> <StackPanel Margin="20">
<TreeDataGridColumnHeader Header="123" /> <TreeDataGridColumnHeader Header="123" />
@@ -113,9 +112,9 @@
</Setter> </Setter>
<Style Selector="^:pointerover /template/ Border#DataGridBorder"> <Style Selector="^:pointerover /template/ Border#DataGridBorder">
<Setter Property="Background" Value="{DynamicResource TreeDataGridHeaderPointeroverBackground}" /> <Setter Property="Background" Value="{DynamicResource TreeDataGridHeaderPointerOverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource TreeDataGridHeaderPointeroverBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource TreeDataGridHeaderPointerOverBorderBrush}" />
<Setter Property="TextBlock.Foreground" Value="{DynamicResource TreeDataGridHeaderPointeroverForeground}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource TreeDataGridHeaderPointerOverForeground}" />
</Style> </Style>
<Style Selector="^:pressed /template/ Border#DataGridBorder"> <Style Selector="^:pressed /template/ Border#DataGridBorder">

View File

@@ -2,9 +2,9 @@
x:Class="Semi.Avalonia.SemiPopupAnimations" x:Class="Semi.Avalonia.SemiPopupAnimations"
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:semi="https://irihi.tech/semi"> xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
<Style Selector="Popup LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup LayoutTransformControl#PART_LayoutTransform">
<Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={semi:PlacementToRenderTransformOriginConverter}}" /> <Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={x:Static converters:PlacementToRenderTransformOriginConverter.Instance}}" />
</Style> </Style>
<Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform">

View File

@@ -1,6 +1,7 @@
<ResourceDictionary <ResourceDictionary
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"
x:CompileBindings="True">
<ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer"> <ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer">
<Setter Property="DefaultFocusAdorner"> <Setter Property="DefaultFocusAdorner">
<FocusAdornerTemplate> <FocusAdornerTemplate>

Some files were not shown because too many files have changed in this diff Show More