mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
Compare commits
160 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78bc6c370b | ||
|
|
2999beefac | ||
|
|
77a05fb801 | ||
|
|
98dd72e9e3 | ||
|
|
5a954fbca8 | ||
|
|
2da0733bdf | ||
|
|
a5255bd032 | ||
|
|
7530061ca4 | ||
|
|
58c1c365a9 | ||
|
|
b5fe4d92a6 | ||
|
|
5d0116ca8e | ||
|
|
e981fe1c82 | ||
|
|
232ce71677 | ||
|
|
3fceec143d | ||
|
|
a99db733ed | ||
|
|
bb928fb239 | ||
|
|
371eb1b0d3 | ||
|
|
e56ef9d6ca | ||
|
|
0eeba47e88 | ||
|
|
96078a4115 | ||
|
|
26ef3ebf36 | ||
|
|
8615783b61 | ||
|
|
a0ca9fa4d0 | ||
|
|
e6ff4103ef | ||
|
|
2514d919f1 | ||
|
|
7a4b18e14a | ||
|
|
32e5e6b5f2 | ||
|
|
c253154e8f | ||
|
|
8955c83fd9 | ||
|
|
ea51867f0f | ||
|
|
8bb314984e | ||
|
|
af6c52660d | ||
|
|
f6962657fa | ||
|
|
8df91270b1 | ||
|
|
22f61cd836 | ||
|
|
86848b548f | ||
|
|
67fd0c4ca3 | ||
|
|
263c65dd18 | ||
|
|
26bb251d1e | ||
|
|
609dfbb5f0 | ||
|
|
ad4bead1bd | ||
|
|
02444f7f16 | ||
|
|
06d9e35add | ||
|
|
1200c9a1c9 | ||
|
|
7600b187f4 | ||
|
|
c55efe8835 | ||
|
|
1fe4df3716 | ||
|
|
c22211df24 | ||
|
|
6459863395 | ||
|
|
ab824fbcd2 | ||
|
|
e4adde26d2 | ||
|
|
057c31a311 | ||
|
|
ef8531d25d | ||
|
|
c44b9a0173 | ||
|
|
5715bba345 | ||
|
|
96b0999db1 | ||
|
|
ffd9b08acc | ||
|
|
64fd8a787a | ||
|
|
4087b685e8 | ||
|
|
70669406b2 | ||
|
|
9925f363f2 | ||
|
|
d328c66be0 | ||
|
|
049552f254 | ||
|
|
ec9233c51b | ||
|
|
6434c400d4 | ||
|
|
00b0e01198 | ||
|
|
19285645ee | ||
|
|
154a005b84 | ||
|
|
3c8ca20337 | ||
|
|
9947bffa07 | ||
|
|
0f872689a2 | ||
|
|
81f36f6559 | ||
|
|
2424c48070 | ||
|
|
40bf46dec5 | ||
|
|
5770065960 | ||
|
|
ecb15c978e | ||
|
|
5f5f9d2d60 | ||
|
|
382617f269 | ||
|
|
b13e719201 | ||
|
|
013eb39bac | ||
|
|
b25181c5bc | ||
|
|
0eb138d73c | ||
|
|
67cbcfe313 | ||
|
|
a6a4837151 | ||
|
|
9ac71cf726 | ||
|
|
d60b32adc6 | ||
|
|
04a113c546 | ||
|
|
9b4d6967a5 | ||
|
|
c302da6e4b | ||
|
|
dbae6edf40 | ||
|
|
8aa58355af | ||
|
|
1d18dd743a | ||
|
|
4ee9251b5a | ||
|
|
42285130d0 | ||
|
|
b03dfdf494 | ||
|
|
7ba3fbcb7a | ||
|
|
c437e6c79c | ||
|
|
f71e2630bb | ||
|
|
f891e05e4c | ||
|
|
77cd48ecfe | ||
|
|
329e041ced | ||
|
|
5222e64197 | ||
|
|
4c0f6dbf25 | ||
|
|
24f46bd12f | ||
|
|
afb5b65a51 | ||
|
|
25aa8fa3f2 | ||
|
|
50c3b7cf0b | ||
|
|
691e9987bc | ||
|
|
67f33125f6 | ||
|
|
729b92e35f | ||
|
|
e61c07f352 | ||
|
|
9ef0e418b8 | ||
|
|
de58cf9f3d | ||
|
|
d0f5b5ef7b | ||
|
|
5d51b158fa | ||
|
|
a02b017be7 | ||
|
|
d9b5eefd10 | ||
|
|
fb3f4fee16 | ||
|
|
3e295097df | ||
|
|
2aaec47fa6 | ||
|
|
9c96d6e476 | ||
|
|
ae9421f666 | ||
|
|
8e55ff1a6f | ||
|
|
8b3dbfc225 | ||
|
|
db28c82476 | ||
|
|
002619a8b5 | ||
|
|
f3c4714372 | ||
|
|
9cabf55ebd | ||
|
|
f318d33764 | ||
|
|
e4445da37b | ||
|
|
42aa2c7f17 | ||
|
|
a909b6da6e | ||
|
|
a8cdf5688b | ||
|
|
2ce8bcdc1b | ||
|
|
50b5159d17 | ||
|
|
fe380f9b0b | ||
|
|
2bded9434b | ||
|
|
3c8854f9de | ||
|
|
147d4fd968 | ||
|
|
142abbf3da | ||
|
|
b4d5a3f932 | ||
|
|
266fdade35 | ||
|
|
f138ae457e | ||
|
|
cc001e951e | ||
|
|
faee95f12f | ||
|
|
ed6b8c7469 | ||
|
|
7ac603b18e | ||
|
|
4803f0e65a | ||
|
|
ed84181b1c | ||
|
|
7207e595f6 | ||
|
|
f83dbafe7a | ||
|
|
53540e679b | ||
|
|
869fd70aef | ||
|
|
36d096d813 | ||
|
|
31e082f46e | ||
|
|
fa8b2d1f21 | ||
|
|
e4ecbfd1e8 | ||
|
|
bc050308fc | ||
|
|
904b7caa75 | ||
|
|
5af0fde583 |
14
.github/workflows/deploy.yml
vendored
14
.github/workflows/deploy.yml
vendored
@@ -4,10 +4,7 @@ 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/net8.0-browser/publish/wwwroot
|
OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/bin/Release/net8.0-browser/publish/wwwroot
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
branches: [ "action/deploy" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "action/deploy" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-to-github-pages:
|
deploy-to-github-pages:
|
||||||
@@ -28,7 +25,7 @@ jobs:
|
|||||||
run: dotnet publish $PROJECT_PATH -c Release --nologo
|
run: dotnet publish $PROJECT_PATH -c Release --nologo
|
||||||
|
|
||||||
- name: Change base-tag in index.html
|
- name: Change base-tag in index.html
|
||||||
run: sed -i 's/<base href="\/" \/>/<base href="\/Semi.Avalonia\/" \/>/g' $OUTPUT_PATH/index.html
|
run: sed -i 's#<base href="/" />#<base href="/Semi.Avalonia/" />#g' $OUTPUT_PATH/index.html
|
||||||
|
|
||||||
- name: copy index.html to 404.html
|
- name: copy index.html to 404.html
|
||||||
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
|
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
|
||||||
@@ -39,6 +36,7 @@ jobs:
|
|||||||
- name: Commit wwwroot to GitHub Pages
|
- name: Commit wwwroot to GitHub Pages
|
||||||
uses: JamesIves/github-pages-deploy-action@v4.5.0
|
uses: JamesIves/github-pages-deploy-action@v4.5.0
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
BRANCH: gh-pages
|
branch: gh-pages
|
||||||
FOLDER: ${{ env.OUTPUT_PATH }}
|
folder: ${{ env.OUTPUT_PATH }}
|
||||||
|
single-commit: true
|
||||||
73
.github/workflows/pack-nightly.yml
vendored
Normal file
73
.github/workflows/pack-nightly.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
name: Pack Nightly
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
Version_Prefix:
|
||||||
|
description: 'Version Prefix'
|
||||||
|
required: true
|
||||||
|
default: '11.2.999'
|
||||||
|
type: string
|
||||||
|
Semi_Avalonia:
|
||||||
|
description: 'Pack Semi.Avalonia'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_ColorPicker:
|
||||||
|
description: 'Pack Semi.Avalonia.ColorPicker'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_DataGrid:
|
||||||
|
description: 'Pack Semi.Avalonia.DataGrid'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_TreeDataGrid:
|
||||||
|
description: 'Pack Semi.Avalonia.TreeDataGrid'
|
||||||
|
required: true
|
||||||
|
default: 'false'
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Pack_Nightly:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
|
- name: Get Version
|
||||||
|
run: |
|
||||||
|
VERSION_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
|
||||||
|
VERSION="${{ github.event.inputs.Version_Prefix }}-nightly-${VERSION_TIMESTAMP}"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia -o ./nugets /p:Version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.ColorPicker
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia_ColorPicker == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets /p:Version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.DataGrid
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia_DataGrid == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets /p:Version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.TreeDataGrid
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia_TreeDataGrid == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -o ./nugets /p:Version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Add NuGet Source
|
||||||
|
run: dotnet nuget add source ${{ secrets.IRIHI_NUGET_NIGHTLY_FEED }} -n irihi.tech -u ${{ secrets.IRIHI_NUGET_USERNAME }} -p ${{ secrets.IRIHI_NUGET_PASSWORD }} --store-password-in-clear-text
|
||||||
|
|
||||||
|
- name: Publish Nightly Package
|
||||||
|
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v4.3.1
|
||||||
|
with:
|
||||||
|
name: nugets
|
||||||
|
path: ./nugets
|
||||||
|
if: always()
|
||||||
26
.github/workflows/pack-tree.yml
vendored
26
.github/workflows/pack-tree.yml
vendored
@@ -1,26 +0,0 @@
|
|||||||
name: Pack TreeDataGrid Nuget
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "action/pack-tree" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "action/pack-tree" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
nuget:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4.1.1
|
|
||||||
|
|
||||||
- name: Nuget Semi.Avalonia.TreeDataGrid
|
|
||||||
run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -o ./nugets
|
|
||||||
|
|
||||||
- name: Publish NuGet package
|
|
||||||
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
|
||||||
uses: actions/upload-artifact@v4.3.1
|
|
||||||
with:
|
|
||||||
name: nugets
|
|
||||||
path: ./nugets
|
|
||||||
49
.github/workflows/pack.yml
vendored
49
.github/workflows/pack.yml
vendored
@@ -1,26 +1,52 @@
|
|||||||
name: Pack Nuget
|
name: Pack to NuGet
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
branches: [ "action/pack" ]
|
inputs:
|
||||||
pull_request:
|
Semi_Avalonia:
|
||||||
branches: [ "action/pack" ]
|
description: 'Pack Semi.Avalonia'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_ColorPicker:
|
||||||
|
description: 'Pack Semi.Avalonia.ColorPicker'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_DataGrid:
|
||||||
|
description: 'Pack Semi.Avalonia.DataGrid'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
|
type: boolean
|
||||||
|
Semi_Avalonia_TreeDataGrid:
|
||||||
|
description: 'Pack Semi.Avalonia.TreeDataGrid'
|
||||||
|
required: true
|
||||||
|
default: 'false'
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nuget:
|
Pack_to_NuGet:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4.1.1
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
- name: Nuget Semi.Avalonia
|
- name: Pack Semi.Avalonia
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia == 'true' }}
|
||||||
run: dotnet pack ./src/Semi.Avalonia -o ./nugets
|
run: dotnet pack ./src/Semi.Avalonia -o ./nugets
|
||||||
|
|
||||||
- name: Nuget Semi.Avalonia.ColorPicker
|
- name: Pack Semi.Avalonia.ColorPicker
|
||||||
run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets
|
if: ${{ github.event.inputs.Semi_Avalonia_ColorPicker == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets
|
||||||
|
|
||||||
- name: Nuget Semi.Avalonia.DataGrid
|
- name: Pack Semi.Avalonia.DataGrid
|
||||||
run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets
|
if: ${{ github.event.inputs.Semi_Avalonia_DataGrid == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.TreeDataGrid
|
||||||
|
if: ${{ github.event.inputs.Semi_Avalonia_TreeDataGrid == 'true' }}
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -o ./nugets
|
||||||
|
|
||||||
- name: Publish NuGet package
|
- name: Publish NuGet package
|
||||||
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||||
@@ -30,3 +56,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: nugets
|
name: nugets
|
||||||
path: ./nugets
|
path: ./nugets
|
||||||
|
if: always()
|
||||||
36
.github/workflows/publish.yml
vendored
36
.github/workflows/publish.yml
vendored
@@ -1,13 +1,32 @@
|
|||||||
name: Publish Demo
|
name: Publish Demo
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
branches: [ "action/publish" ]
|
inputs:
|
||||||
pull_request:
|
platform:
|
||||||
branches: [ "action/publish" ]
|
description: 'Platform to publish'
|
||||||
|
required: true
|
||||||
|
default: 'all'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 'windows'
|
||||||
|
- 'linux'
|
||||||
|
- 'android'
|
||||||
|
- 'all'
|
||||||
|
include_aot:
|
||||||
|
description: 'Include Windows AOT packaging'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
include_drm:
|
||||||
|
description: 'Include Linux DRM packaging'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows:
|
||||||
|
if: ${{ github.event.inputs.platform == 'windows' || github.event.inputs.platform == 'all' }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -25,14 +44,17 @@ jobs:
|
|||||||
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip
|
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip
|
||||||
|
|
||||||
- name: Enable Native AOT in .csproj
|
- name: Enable Native AOT in .csproj
|
||||||
|
if: ${{ github.event.inputs.include_aot == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||||||
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||||||
|
|
||||||
- name: Publish win-x64 AOT
|
- name: Publish win-x64 AOT
|
||||||
|
if: ${{ github.event.inputs.include_aot == 'true' }}
|
||||||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
|
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
|
||||||
|
|
||||||
- name: Zip win-x64 AOT
|
- name: Zip win-x64 AOT
|
||||||
|
if: ${{ github.event.inputs.include_aot == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
|
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
|
||||||
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT.zip
|
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT.zip
|
||||||
@@ -44,6 +66,7 @@ jobs:
|
|||||||
path: ./upload
|
path: ./upload
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
|
if: ${{ github.event.inputs.platform == 'linux' || github.event.inputs.platform == 'all' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -59,9 +82,11 @@ jobs:
|
|||||||
run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
|
run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
|
||||||
|
|
||||||
- name: Publish linux-x64 DRM
|
- name: Publish linux-x64 DRM
|
||||||
|
if: ${{ github.event.inputs.include_drm == 'true' }}
|
||||||
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/drm
|
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/drm
|
||||||
|
|
||||||
- name: Zip linux-x64 DRM
|
- name: Zip linux-x64 DRM
|
||||||
|
if: ${{ github.event.inputs.include_drm == 'true' }}
|
||||||
run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb"
|
run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb"
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
- name: Upload a Build Artifact
|
||||||
@@ -71,6 +96,7 @@ jobs:
|
|||||||
path: ./upload
|
path: ./upload
|
||||||
|
|
||||||
android:
|
android:
|
||||||
|
if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -83,7 +109,7 @@ jobs:
|
|||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Publish Android
|
- name: Publish Android
|
||||||
run: dotnet publish demo/Semi.Avalonia.Demo.Android -c Release -f net8.0-android --no-restore -o ./publish
|
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.3.1
|
uses: actions/upload-artifact@v4.3.1
|
||||||
|
|||||||
149
.github/workflows/release-tag.yml
vendored
Normal file
149
.github/workflows/release-tag.yml
vendored
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
name: Release Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pack:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia -o ./nugets
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.ColorPicker
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets
|
||||||
|
|
||||||
|
- name: Pack Semi.Avalonia.DataGrid
|
||||||
|
run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nugets
|
||||||
|
path: ./nugets
|
||||||
|
|
||||||
|
publish-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Make upload directory
|
||||||
|
run: mkdir upload
|
||||||
|
|
||||||
|
- name: Publish win-x64
|
||||||
|
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/win64
|
||||||
|
|
||||||
|
- name: Zip win-x64
|
||||||
|
run: |
|
||||||
|
$files = Get-ChildItem -Path ./publish/win64/* -Recurse -Exclude *.pdb
|
||||||
|
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip
|
||||||
|
|
||||||
|
- 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
|
||||||
|
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||||||
|
|
||||||
|
- name: Publish win-x64 AOT
|
||||||
|
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
|
||||||
|
|
||||||
|
- name: Zip win-x64 AOT
|
||||||
|
run: |
|
||||||
|
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
|
||||||
|
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT.zip
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
path: ./upload
|
||||||
|
|
||||||
|
publish-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Make upload directory
|
||||||
|
run: mkdir upload
|
||||||
|
|
||||||
|
- name: Publish linux-x64
|
||||||
|
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/linux64
|
||||||
|
|
||||||
|
- name: Zip linux-x64
|
||||||
|
run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
|
||||||
|
|
||||||
|
- name: Publish linux-x64 DRM
|
||||||
|
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/drm
|
||||||
|
|
||||||
|
- name: Zip linux-x64 DRM
|
||||||
|
run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb"
|
||||||
|
|
||||||
|
- name: Upload a Build Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux
|
||||||
|
path: ./upload
|
||||||
|
|
||||||
|
publish-android:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: CD Android
|
||||||
|
run: cd ./demo/Semi.Avalonia.Demo.Android
|
||||||
|
|
||||||
|
- name: Restore Dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Publish Android
|
||||||
|
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
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: android
|
||||||
|
path: ./publish/*Signed.apk
|
||||||
|
|
||||||
|
draft-release:
|
||||||
|
needs: [ pack, publish-windows, publish-linux, publish-android ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download nugets Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nugets
|
||||||
|
|
||||||
|
- name: Download windows Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
|
||||||
|
- name: Download linux Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux
|
||||||
|
|
||||||
|
- name: Download android Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: android
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
||||||
|
with:
|
||||||
|
generate_release_notes: true
|
||||||
|
draft: true
|
||||||
|
files: |
|
||||||
|
*.nupkg
|
||||||
|
*.zip
|
||||||
|
*.apk
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
||||||
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
||||||
|
[](https://gitcode.com/IRIHI_Technology/Semi.Avalonia)
|
||||||
|
|
||||||
[中文](./README_CN.md)
|
[中文](./README_CN.md)
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ We offer limited free community support for Semi Avalonia and Ursa. If you have
|
|||||||
|
|
||||||
| Semi Design Version | Avalonia Version |
|
| Semi Design Version | Avalonia Version |
|
||||||
|:--------------------|:-----------------|
|
|:--------------------|:-----------------|
|
||||||
| 11.2.1 | 11.2.1 |
|
| 11.2.1 | >=11.2.1 |
|
||||||
| 11.2.0 | 11.2.0 |
|
| 11.2.0 | 11.2.0 |
|
||||||
| 11.1.0 | >=11.1.0 |
|
| 11.1.0 | >=11.1.0 |
|
||||||
| 11.0.7 | >=11.0.7 |
|
| 11.0.7 | >=11.0.7 |
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
||||||
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
[](https://www.nuget.org/packages/Semi.Avalonia/)
|
||||||
|
[](https://gitcode.com/IRIHI_Technology/Semi.Avalonia)
|
||||||
|
|
||||||
[English](./README.md)
|
[English](./README.md)
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ dotnet add package Semi.Avalonia.TreeDataGrid
|
|||||||
|
|
||||||
| Semi Design Version | Avalonia Version |
|
| Semi Design Version | Avalonia Version |
|
||||||
|:--------------------|:-----------------|
|
|:--------------------|:-----------------|
|
||||||
| 11.2.1 | 11.2.1 |
|
| 11.2.1 | >=11.2.1 |
|
||||||
| 11.2.0 | 11.2.0 |
|
| 11.2.0 | 11.2.0 |
|
||||||
| 11.1.0 | >=11.1.0 |
|
| 11.1.0 | >=11.1.0 |
|
||||||
| 11.0.7 | >=11.0.7 |
|
| 11.0.7 | >=11.0.7 |
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Act
|
|||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.github\workflows\deploy.yml = .github\workflows\deploy.yml
|
.github\workflows\deploy.yml = .github\workflows\deploy.yml
|
||||||
.github\workflows\pack.yml = .github\workflows\pack.yml
|
.github\workflows\pack.yml = .github\workflows\pack.yml
|
||||||
.github\workflows\pack-tree.yml = .github\workflows\pack-tree.yml
|
.github\workflows\pack-nightly.yml = .github\workflows\pack-nightly.yml
|
||||||
.github\workflows\publish.yml = .github\workflows\publish.yml
|
.github\workflows\publish.yml = .github\workflows\publish.yml
|
||||||
|
.github\workflows\release-tag.yml = .github\workflows\release-tag.yml
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{43091528-9509-43CB-A003-9C5C11E96DD6}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{43091528-9509-43CB-A003-9C5C11E96DD6}"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Nullable>enable</Nullable>
|
<AvaloniaVersion>11.2.3</AvaloniaVersion>
|
||||||
<AvaloniaVersion>11.2.1</AvaloniaVersion>
|
<CommunityToolkitVersion>8.4.0</CommunityToolkitVersion>
|
||||||
<CommunityToolkitVersion>8.3.2</CommunityToolkitVersion>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
using Avalonia;
|
using System;
|
||||||
|
using Avalonia;
|
||||||
using Avalonia.Dialogs;
|
using Avalonia.Dialogs;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Desktop;
|
namespace Semi.Avalonia.Demo.Desktop;
|
||||||
|
|
||||||
class Program
|
sealed class Program
|
||||||
{
|
{
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
@@ -33,4 +31,4 @@ class Program
|
|||||||
.UsePlatformDetect()
|
.UsePlatformDetect()
|
||||||
.With(new Win32PlatformOptions())
|
.With(new Win32PlatformOptions())
|
||||||
.LogToTrace();
|
.LogToTrace();
|
||||||
}
|
}
|
||||||
@@ -19,16 +19,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<TrimmerRootDescriptor Include="Roots.xml" />
|
<TrimmerRootDescriptor Include="Roots.xml"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
|
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Avalonia.Dialogs;
|
|||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Drm;
|
namespace Semi.Avalonia.Demo.Drm;
|
||||||
|
|
||||||
class Program
|
sealed class Program
|
||||||
{
|
{
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
|||||||
@@ -19,17 +19,15 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<TrimmerRootDescriptor Include="Roots.xml" />
|
<TrimmerRootDescriptor Include="Roots.xml"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
|
||||||
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
|
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<TargetFramework>net8.0-browser</TargetFramework>
|
<TargetFramework>net8.0-browser</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 162 KiB |
@@ -6,6 +6,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="./app.css" />
|
<link rel="stylesheet" href="./app.css" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="margin: 0; overflow: hidden">
|
<body style="margin: 0; overflow: hidden">
|
||||||
|
|||||||
@@ -2,12 +2,35 @@
|
|||||||
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"
|
||||||
xmlns:semi="https://irihi.tech/semi">
|
x:CompileBindings="True"
|
||||||
|
x:DataType="viewModels:ApplicationViewModel"
|
||||||
|
xmlns:semi="https://irihi.tech/semi"
|
||||||
|
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels">
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<!-- You can still reference in old way. -->
|
<!-- You can still reference in old way. -->
|
||||||
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
|
<!-- <StyleInclude Source="avares://Semi.Avalonia/Index.axaml" /> -->
|
||||||
<semi:SemiTheme Locale="zh-cn" />
|
<semi:SemiTheme Locale="zh-CN" />
|
||||||
|
<semi:SemiPopupAnimations />
|
||||||
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
|
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
|
||||||
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
|
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceInclude
|
||||||
|
Source="Themes/_index.axaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
<TrayIcon.Icons>
|
||||||
|
<TrayIcons>
|
||||||
|
<TrayIcon Icon="/Assets/irihi.ico" MacOSProperties.IsTemplateIcon="true" ToolTipText="Semi Avalonia Demo">
|
||||||
|
<TrayIcon.Menu>
|
||||||
|
<NativeMenu>
|
||||||
|
<NativeMenuItem Header="Exit" Command="{Binding ExitCommand}" />
|
||||||
|
</NativeMenu>
|
||||||
|
</TrayIcon.Menu>
|
||||||
|
</TrayIcon>
|
||||||
|
</TrayIcons>
|
||||||
|
</TrayIcon.Icons>
|
||||||
</Application>
|
</Application>
|
||||||
@@ -2,6 +2,7 @@ using Avalonia;
|
|||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Data.Core.Plugins;
|
using Avalonia.Data.Core.Plugins;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
using Semi.Avalonia.Demo.Views;
|
using Semi.Avalonia.Demo.Views;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo;
|
namespace Semi.Avalonia.Demo;
|
||||||
@@ -11,6 +12,7 @@ public partial class App : Application
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
this.DataContext = new ApplicationViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnFrameworkInitializationCompleted()
|
public override void OnFrameworkInitializationCompleted()
|
||||||
@@ -28,6 +30,7 @@ public partial class App : Application
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.RegisterFollowSystemTheme();
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 172 KiB |
BIN
demo/Semi.Avalonia.Demo/Assets/irihi.ico
Normal file
BIN
demo/Semi.Avalonia.Demo/Assets/irihi.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
143
demo/Semi.Avalonia.Demo/Constant/ColorTokens.cs
Normal file
143
demo/Semi.Avalonia.Demo/Constant/ColorTokens.cs
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Constant;
|
||||||
|
|
||||||
|
public static class ColorTokens
|
||||||
|
{
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> PrimaryTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorPrimary", "Primary"),
|
||||||
|
new("SemiColorPrimaryPointerover", "Primary Pointerover"),
|
||||||
|
new("SemiColorPrimaryActive", "Primary Active"),
|
||||||
|
new("SemiColorPrimaryDisabled", "Primary Disabled"),
|
||||||
|
new("SemiColorPrimaryLight", "Primary Light"),
|
||||||
|
new("SemiColorPrimaryLightPointerover", "Primary Light Pointerover"),
|
||||||
|
new("SemiColorPrimaryLightActive", "Primary Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> SecondaryTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorSecondary", "Secondary"),
|
||||||
|
new("SemiColorSecondaryPointerover", "Secondary Pointerover"),
|
||||||
|
new("SemiColorSecondaryActive", "Secondary Active"),
|
||||||
|
new("SemiColorSecondaryDisabled", "Secondary Disabled"),
|
||||||
|
new("SemiColorSecondaryLight", "Secondary Light"),
|
||||||
|
new("SemiColorSecondaryLightPointerover", "Secondary Light Pointerover"),
|
||||||
|
new("SemiColorSecondaryLightActive", "Secondary Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> TertiaryTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorTertiary", "Tertiary"),
|
||||||
|
new("SemiColorTertiaryPointerover", "Tertiary Pointerover"),
|
||||||
|
new("SemiColorTertiaryActive", "Tertiary Active"),
|
||||||
|
new("SemiColorTertiaryLight", "Tertiary Light"),
|
||||||
|
new("SemiColorTertiaryLightPointerover", "Tertiary Light Pointerover"),
|
||||||
|
new("SemiColorTertiaryLightActive", "Tertiary Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> InformationTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorInformation", "Information"),
|
||||||
|
new("SemiColorInformationPointerover", "Information Pointerover"),
|
||||||
|
new("SemiColorInformationActive", "Information Active"),
|
||||||
|
new("SemiColorInformationDisabled", "Information Disabled"),
|
||||||
|
new("SemiColorInformationLight", "Information Light"),
|
||||||
|
new("SemiColorInformationLightPointerover", "Information Light Pointerover"),
|
||||||
|
new("SemiColorInformationLightActive", "Information Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> SuccessTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorSuccess", "Success"),
|
||||||
|
new("SemiColorSuccessPointerover", "Success Pointerover"),
|
||||||
|
new("SemiColorSuccessActive", "Success Active"),
|
||||||
|
new("SemiColorSuccessDisabled", "Success Disabled"),
|
||||||
|
new("SemiColorSuccessLight", "Success Light"),
|
||||||
|
new("SemiColorSuccessLightPointerover", "Success Light Pointerover"),
|
||||||
|
new("SemiColorSuccessLightActive", "Success Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> WarningTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorWarning", "Warning"),
|
||||||
|
new("SemiColorWarningPointerover", "Warning Pointerover"),
|
||||||
|
new("SemiColorWarningActive", "Warning Active"),
|
||||||
|
new("SemiColorWarningLight", "Warning Light"),
|
||||||
|
new("SemiColorWarningLightPointerover", "Warning Light Pointerover"),
|
||||||
|
new("SemiColorWarningLightActive", "Warning Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> DangerTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorDanger", "Danger"),
|
||||||
|
new("SemiColorDangerPointerover", "Danger Pointerover"),
|
||||||
|
new("SemiColorDangerActive", "Danger Active"),
|
||||||
|
new("SemiColorDangerLight", "Danger Light"),
|
||||||
|
new("SemiColorDangerLightPointerover", "Danger Light Pointerover"),
|
||||||
|
new("SemiColorDangerLightActive", "Danger Light Active"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorText0", "Text 0"),
|
||||||
|
new("SemiColorText1", "Text 1"),
|
||||||
|
new("SemiColorText2", "Text 2"),
|
||||||
|
new("SemiColorText3", "Text 3"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> LinkTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorLink", "Link"),
|
||||||
|
new("SemiColorLinkPointerover", "Link Pointerover"),
|
||||||
|
new("SemiColorLinkActive", "Link Active"),
|
||||||
|
new("SemiColorLinkVisited", "Link Visited"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> BackgroundTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorBackground0", "Background 0"),
|
||||||
|
new("SemiColorBackground1", "Background 1"),
|
||||||
|
new("SemiColorBackground2", "Background 2"),
|
||||||
|
new("SemiColorBackground3", "Background 3"),
|
||||||
|
new("SemiColorBackground4", "Background 4"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> FillTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorFill0", "Fill 0"),
|
||||||
|
new("SemiColorFill1", "Fill 1"),
|
||||||
|
new("SemiColorFill2", "Fill 2"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> BorderTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorBorder", "Border"),
|
||||||
|
new("SemiColorFocusBorder", "Focus Border"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> DisabledTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorDisabledText", "Disabled Text"),
|
||||||
|
new("SemiColorDisabledBorder", "Disabled Border"),
|
||||||
|
new("SemiColorDisabledBackground", "Disabled Background"),
|
||||||
|
new("SemiColorDisabledFill", "Disabled Fill"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> OtherTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorWhite", "White"),
|
||||||
|
new("SemiColorBlack", "Black"),
|
||||||
|
new("SemiColorNavBackground", "Navigation Background"),
|
||||||
|
new("SemiColorOverlayBackground", "Overlay Background"),
|
||||||
|
new("SemiColorHighlightBackground", "Highlight Background"),
|
||||||
|
new("SemiColorHighlight", "Highlight Text"),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static IReadOnlyList<Tuple<string, string>> ShadowTokens { get; } = new List<Tuple<string, string>>
|
||||||
|
{
|
||||||
|
new("SemiColorShadow", "Shadow"),
|
||||||
|
new("SemiShadowElevated", "Shadow Elevated"),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,30 +1,32 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
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 Avalonia.Media.Immutable;
|
using Semi.Avalonia.Demo.Converters;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Controls;
|
namespace Semi.Avalonia.Demo.Controls;
|
||||||
|
|
||||||
public class ColorDetailControl: TemplatedControl
|
public class ColorDetailControl : TemplatedControl
|
||||||
{
|
{
|
||||||
public const string KEY_ResourceKey = "ResourceKey";
|
public const string KEY_ResourceKey = "ResourceKey";
|
||||||
public const string KEY_Hex = "Hex";
|
public const string KEY_Hex = "Hex";
|
||||||
|
public const string KEY_Hex2 = "Hex2";
|
||||||
public const string KEY_Opacity = "Opacity";
|
public const string KEY_Opacity = "Opacity";
|
||||||
public const string KEY_ColorResourceKey = "ColorResourceKey";
|
public const string KEY_ColorResourceKey = "ColorResourceKey";
|
||||||
|
|
||||||
public static readonly StyledProperty<string?> ResourceKeyProperty = AvaloniaProperty.Register<ColorDetailControl, string?>(
|
public static readonly StyledProperty<string?> ResourceKeyProperty =
|
||||||
nameof(ResourceKey));
|
AvaloniaProperty.Register<ColorDetailControl, string?>(nameof(ResourceKey));
|
||||||
|
|
||||||
public string? ResourceKey
|
public string? ResourceKey
|
||||||
{
|
{
|
||||||
get => GetValue(ResourceKeyProperty);
|
get => GetValue(ResourceKeyProperty);
|
||||||
set => SetValue(ResourceKeyProperty, value);
|
set => SetValue(ResourceKeyProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<string?> ResourceNameProperty = AvaloniaProperty.Register<ColorDetailControl, string?>(
|
public static readonly StyledProperty<string?> ResourceNameProperty =
|
||||||
nameof(ResourceName));
|
AvaloniaProperty.Register<ColorDetailControl, string?>(nameof(ResourceName));
|
||||||
|
|
||||||
public string? ResourceName
|
public string? ResourceName
|
||||||
{
|
{
|
||||||
@@ -32,8 +34,8 @@ public class ColorDetailControl: TemplatedControl
|
|||||||
set => SetValue(ResourceNameProperty, value);
|
set => SetValue(ResourceNameProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<string?> ColorResourceKeyProperty = AvaloniaProperty.Register<ColorDetailControl, string?>(
|
public static readonly StyledProperty<string?> ColorResourceKeyProperty =
|
||||||
nameof(ColorResourceKey));
|
AvaloniaProperty.Register<ColorDetailControl, string?>(nameof(ColorResourceKey));
|
||||||
|
|
||||||
public string? ColorResourceKey
|
public string? ColorResourceKey
|
||||||
{
|
{
|
||||||
@@ -41,27 +43,39 @@ public class ColorDetailControl: TemplatedControl
|
|||||||
set => SetValue(ColorResourceKeyProperty, value);
|
set => SetValue(ColorResourceKeyProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DirectProperty<ColorDetailControl, string?> HexProperty = AvaloniaProperty.RegisterDirect<ColorDetailControl, string?>(
|
public static readonly DirectProperty<ColorDetailControl, string?> HexProperty =
|
||||||
nameof(Hex), o => o.Hex);
|
AvaloniaProperty.RegisterDirect<ColorDetailControl, string?>(nameof(Hex), o => o.Hex);
|
||||||
|
|
||||||
private string? _hex;
|
private string? _hex;
|
||||||
|
|
||||||
public string? Hex
|
public string? Hex
|
||||||
{
|
{
|
||||||
get => _hex;
|
get => _hex;
|
||||||
private set => SetAndRaise(HexProperty, ref _hex, value);
|
private set => SetAndRaise(HexProperty, ref _hex, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DirectProperty<ColorDetailControl, string?> OpacityNumberProperty = AvaloniaProperty.RegisterDirect<ColorDetailControl, string?>(
|
private string? _hex2;
|
||||||
nameof(OpacityNumber), o => o.OpacityNumber);
|
|
||||||
|
public static readonly DirectProperty<ColorDetailControl, string?> Hex2Property =
|
||||||
|
AvaloniaProperty.RegisterDirect<ColorDetailControl, string?>(nameof(Hex2), o => o.Hex2);
|
||||||
|
|
||||||
|
public string? Hex2
|
||||||
|
{
|
||||||
|
get => _hex2;
|
||||||
|
set => SetAndRaise(Hex2Property, ref _hex2, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DirectProperty<ColorDetailControl, string?> OpacityNumberProperty =
|
||||||
|
AvaloniaProperty.RegisterDirect<ColorDetailControl, string?>(nameof(OpacityNumber), o => o.OpacityNumber);
|
||||||
|
|
||||||
private string? _opacityNumber;
|
private string? _opacityNumber;
|
||||||
|
|
||||||
public string? OpacityNumber
|
public string? OpacityNumber
|
||||||
{
|
{
|
||||||
get => _opacityNumber;
|
get => _opacityNumber;
|
||||||
private set => SetAndRaise(OpacityNumberProperty, ref _opacityNumber, value);
|
private set => SetAndRaise(OpacityNumberProperty, ref _opacityNumber, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ColorDetailControl()
|
static ColorDetailControl()
|
||||||
{
|
{
|
||||||
BackgroundProperty.Changed.AddClassHandler<ColorDetailControl>((o, e) => o.OnBackgroundChanged(e));
|
BackgroundProperty.Changed.AddClassHandler<ColorDetailControl>((o, e) => o.OnBackgroundChanged(e));
|
||||||
@@ -70,38 +84,36 @@ public class ColorDetailControl: TemplatedControl
|
|||||||
private void OnBackgroundChanged(AvaloniaPropertyChangedEventArgs args)
|
private void OnBackgroundChanged(AvaloniaPropertyChangedEventArgs args)
|
||||||
{
|
{
|
||||||
var color = args.GetNewValue<IBrush>();
|
var color = args.GetNewValue<IBrush>();
|
||||||
if (color is ISolidColorBrush b)
|
if (color is ISolidColorBrush brush)
|
||||||
{
|
{
|
||||||
Hex = b.Color.ToString().ToUpperInvariant();
|
var hex1 = ColorConverter.ToHex.Convert(brush.Color, typeof(string), false, CultureInfo.InvariantCulture);
|
||||||
OpacityNumber = b.Opacity.ToString(CultureInfo.InvariantCulture);
|
var hex2 = ColorConverter.ToHex.Convert(brush.Color, typeof(string), true, CultureInfo.InvariantCulture);
|
||||||
|
Hex = hex1 as string;
|
||||||
|
Hex2 = hex2 as string;
|
||||||
|
OpacityNumber = brush.Opacity.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Copy(object o)
|
public async Task Copy(object o)
|
||||||
{
|
{
|
||||||
string? text = null;
|
string? text = null;
|
||||||
if (o is string s)
|
if (o is string s)
|
||||||
{
|
{
|
||||||
switch (s)
|
text = s switch
|
||||||
{
|
{
|
||||||
case KEY_ResourceKey: text = ResourceKey;
|
KEY_ResourceKey => ResourceKey,
|
||||||
break;
|
KEY_Hex => Hex,
|
||||||
case KEY_Hex: text = Hex;
|
KEY_Hex2 => Hex2,
|
||||||
break;
|
KEY_Opacity => OpacityNumber,
|
||||||
case KEY_Opacity: text = OpacityNumber;
|
KEY_ColorResourceKey => ColorResourceKey,
|
||||||
break;
|
_ => string.Empty
|
||||||
case KEY_ColorResourceKey: text = ColorResourceKey;
|
};
|
||||||
break;
|
|
||||||
default: text = string.Empty; break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toplevel = TopLevel.GetTopLevel(this);
|
var toplevel = TopLevel.GetTopLevel(this);
|
||||||
if (toplevel?.Clipboard is { } c)
|
if (toplevel?.Clipboard is { } c)
|
||||||
{
|
{
|
||||||
await c.SetTextAsync(text??string.Empty);
|
await c.SetTextAsync(text ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
@@ -9,8 +8,8 @@ namespace Semi.Avalonia.Demo.Controls;
|
|||||||
|
|
||||||
public class ColorItemControl : TemplatedControl
|
public class ColorItemControl : TemplatedControl
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<string?> ColorNameProperty = AvaloniaProperty.Register<ColorItemControl, string?>(
|
public static readonly StyledProperty<string?> ColorNameProperty =
|
||||||
nameof(ColorName));
|
AvaloniaProperty.Register<ColorItemControl, string?>(nameof(ColorName));
|
||||||
|
|
||||||
public string? ColorName
|
public string? ColorName
|
||||||
{
|
{
|
||||||
@@ -26,14 +25,18 @@ public class ColorItemControl : TemplatedControl
|
|||||||
get => GetValue(HexProperty);
|
get => GetValue(HexProperty);
|
||||||
set => SetValue(HexProperty, value);
|
set => SetValue(HexProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnPointerPressed(e);
|
base.OnPointerPressed(e);
|
||||||
if (this.DataContext is ColorItemViewModel v)
|
switch (this.DataContext)
|
||||||
{
|
{
|
||||||
WeakReferenceMessenger.Default.Send(v);
|
case ColorItemViewModel colorItemViewModel:
|
||||||
|
WeakReferenceMessenger.Default.Send(colorItemViewModel);
|
||||||
|
break;
|
||||||
|
case ColorResource colorResource:
|
||||||
|
WeakReferenceMessenger.Default.Send(colorResource);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
22
demo/Semi.Avalonia.Demo/Converters/ColorConverter.cs
Normal file
22
demo/Semi.Avalonia.Demo/Converters/ColorConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Avalonia.Media;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Converters;
|
||||||
|
|
||||||
|
public static class ColorConverter
|
||||||
|
{
|
||||||
|
public static readonly IValueConverter ToHex =
|
||||||
|
new FuncValueConverter<object, bool, string>(
|
||||||
|
(obj, withAlpha) =>
|
||||||
|
obj switch
|
||||||
|
{
|
||||||
|
Color color => withAlpha
|
||||||
|
? $"#{color.A:X2}{color.R:X2}{color.G:X2}{color.B:X2}"
|
||||||
|
: $"#{color.R:X2}{color.G:X2}{color.B:X2}",
|
||||||
|
ISolidColorBrush brush => withAlpha
|
||||||
|
? $"#{brush.Color.A:X2}{brush.Color.R:X2}{brush.Color.G:X2}{brush.Color.B:X2}"
|
||||||
|
: $"#{brush.Color.R:X2}{brush.Color.G:X2}{brush.Color.B:X2}",
|
||||||
|
_ => string.Empty
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,20 +8,26 @@
|
|||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Styles>
|
<UserControl.Styles>
|
||||||
<Style Selector="Border">
|
<Style Selector="Carousel">
|
||||||
<Setter Property="Height" Value="200" />
|
<Setter Property="Height" Value="200" />
|
||||||
|
<Style Selector="^ TextBlock">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Foreground" Value="#1C1F23" />
|
||||||
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBlock">
|
<Style Selector="RadioButton">
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="Theme" Value="{DynamicResource ButtonRadioButton}" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
|
||||||
<Setter Property="Foreground" Value="#1C1F23" />
|
|
||||||
</Style>
|
</Style>
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<Carousel Theme="{DynamicResource FullCarousel}">
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
<Carousel.PageTransition>
|
Classes.Dot="{Binding #DotButton.IsChecked}"
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
Classes.Columnar="{Binding #ColumnarButton.IsChecked}"
|
||||||
</Carousel.PageTransition>
|
Classes.Line="{Binding #LineButton.IsChecked}"
|
||||||
|
Classes.Left="{Binding #LeftButton.IsChecked}"
|
||||||
|
Classes.Center="{Binding #CenterButton.IsChecked}"
|
||||||
|
Classes.Right="{Binding #RightButton.IsChecked}">
|
||||||
<Border Background="#EAF5FF">
|
<Border Background="#EAF5FF">
|
||||||
<TextBlock Text="Text 1" />
|
<TextBlock Text="Text 1" />
|
||||||
</Border>
|
</Border>
|
||||||
@@ -35,39 +41,39 @@
|
|||||||
<TextBlock Text="Text 4" />
|
<TextBlock Text="Text 4" />
|
||||||
</Border>
|
</Border>
|
||||||
</Carousel>
|
</Carousel>
|
||||||
<Carousel Classes="Line" Theme="{DynamicResource FullCarousel}">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<Carousel.PageTransition>
|
<TextBlock VerticalAlignment="Center" Text="Type" />
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
<Border Theme="{DynamicResource RadioButtonGroupBorder}">
|
||||||
</Carousel.PageTransition>
|
<StackPanel Orientation="Horizontal">
|
||||||
<Border Background="#EAF5FF">
|
<RadioButton
|
||||||
<TextBlock Text="Text 1" />
|
Name="DotButton"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Dot" />
|
||||||
|
<RadioButton
|
||||||
|
Name="ColumnarButton"
|
||||||
|
Content="Columnar" />
|
||||||
|
<RadioButton
|
||||||
|
Name="LineButton"
|
||||||
|
Content="Line" />
|
||||||
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Background="#F9F9F9">
|
</StackPanel>
|
||||||
<TextBlock Text="Text 2" />
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="Position" />
|
||||||
|
<Border Theme="{DynamicResource RadioButtonGroupBorder}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<RadioButton
|
||||||
|
Name="LeftButton"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Left" />
|
||||||
|
<RadioButton
|
||||||
|
Name="CenterButton"
|
||||||
|
Content="Center" />
|
||||||
|
<RadioButton
|
||||||
|
Name="RightButton"
|
||||||
|
Content="Right" />
|
||||||
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Background="#FFF8EA">
|
</StackPanel>
|
||||||
<TextBlock Text="Text 3" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FEF2ED">
|
|
||||||
<TextBlock Text="Text 4" />
|
|
||||||
</Border>
|
|
||||||
</Carousel>
|
|
||||||
<Carousel Classes="Columnar Left" Theme="{DynamicResource FullCarousel}">
|
|
||||||
<Carousel.PageTransition>
|
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
|
||||||
</Carousel.PageTransition>
|
|
||||||
<Border Background="#EAF5FF">
|
|
||||||
<TextBlock Text="Text 1" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#F9F9F9">
|
|
||||||
<TextBlock Text="Text 2" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FFF8EA">
|
|
||||||
<TextBlock Text="Text 3" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FEF2ED">
|
|
||||||
<TextBlock Text="Text 4" />
|
|
||||||
</Border>
|
|
||||||
</Carousel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -27,6 +27,15 @@
|
|||||||
<ComboBox Classes="Small" />
|
<ComboBox Classes="Small" />
|
||||||
<ComboBox Classes="Bordered" />
|
<ComboBox Classes="Bordered" />
|
||||||
<ComboBox Classes="Bordered" IsEnabled="False" />
|
<ComboBox Classes="Bordered" IsEnabled="False" />
|
||||||
|
<ComboBox>
|
||||||
|
<ComboBox.SelectionBoxItemTemplate>
|
||||||
|
<DataTemplate DataType="x:String">
|
||||||
|
<ContentControl BorderThickness="1"
|
||||||
|
BorderBrush="Gold"
|
||||||
|
Content="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.SelectionBoxItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ComboBox Width="100" Classes="Large" PlaceholderText="Large" />
|
<ComboBox Width="100" Classes="Large" PlaceholderText="Large" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Semi.Avalonia.Demo.Pages.GridSplitter"
|
x:Class="Semi.Avalonia.Demo.Pages.GridSplitterDemo"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -14,13 +14,13 @@
|
|||||||
RowDefinitions="*, Auto, *">
|
RowDefinitions="*, Auto, *">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="#FEFBCB"
|
Background="{DynamicResource SemiGrey0Color}"
|
||||||
CornerRadius="10" />
|
CornerRadius="10" />
|
||||||
<GridSplitter Grid.Row="1" ShowsPreview="True" />
|
<GridSplitter Grid.Row="1" ShowsPreview="True" />
|
||||||
<Border
|
<Border
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="#FEFBCB"
|
Background="{DynamicResource SemiGrey0Color}"
|
||||||
CornerRadius="10" />
|
CornerRadius="10" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
@@ -29,13 +29,13 @@
|
|||||||
ColumnDefinitions="*, Auto, *">
|
ColumnDefinitions="*, Auto, *">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="#FEFBCB"
|
Background="{DynamicResource SemiGrey0Color}"
|
||||||
CornerRadius="10" />
|
CornerRadius="10" />
|
||||||
<GridSplitter Grid.Column="1" ShowsPreview="True" />
|
<GridSplitter Grid.Column="1" ShowsPreview="True" />
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="#FEFBCB"
|
Background="{DynamicResource SemiGrey0Color}"
|
||||||
CornerRadius="10" />
|
CornerRadius="10" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
public partial class GridSplitter : UserControl
|
public partial class GridSplitterDemo : UserControl
|
||||||
{
|
{
|
||||||
public GridSplitter()
|
public GridSplitterDemo()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
328
demo/Semi.Avalonia.Demo/Pages/HighContrastDemo.axaml
Normal file
328
demo/Semi.Avalonia.Demo/Pages/HighContrastDemo.axaml
Normal 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>
|
||||||
24
demo/Semi.Avalonia.Demo/Pages/HighContrastDemo.axaml.cs
Normal file
24
demo/Semi.Avalonia.Demo/Pages/HighContrastDemo.axaml.cs
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
95
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml
Normal file
95
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:DataType="vm:IconDemoViewModel"
|
||||||
|
x:Class="Semi.Avalonia.Demo.Pages.IconDemo">
|
||||||
|
<Design.DataContext>
|
||||||
|
<vm:IconDemoViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<Grid RowDefinitions="Auto, *">
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="0"
|
||||||
|
Width="600"
|
||||||
|
Margin="8"
|
||||||
|
Classes="ClearButton"
|
||||||
|
Text="{Binding SearchText}"
|
||||||
|
Watermark="Input Icon Name" />
|
||||||
|
|
||||||
|
<TabControl Grid.Row="1">
|
||||||
|
<TabItem Header="Filled Icons">
|
||||||
|
<ScrollViewer>
|
||||||
|
<ItemsControl ItemsSource="{Binding FilteredFilledIcons}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<WrapPanel />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Theme="{DynamicResource OutlineButton}"
|
||||||
|
Classes="Tertiary"
|
||||||
|
Padding="0"
|
||||||
|
Margin="10"
|
||||||
|
Width="200"
|
||||||
|
Height="120"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<TabItem Header="Stroked Icons">
|
||||||
|
<ScrollViewer>
|
||||||
|
<ItemsControl ItemsSource="{Binding FilteredStrokedIcons}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<WrapPanel />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Theme="{DynamicResource OutlineButton}"
|
||||||
|
Classes="Tertiary"
|
||||||
|
Padding="0"
|
||||||
|
Margin="10"
|
||||||
|
Width="200"
|
||||||
|
Height="120"
|
||||||
|
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>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
47
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml.cs
Normal file
47
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using Avalonia.Controls.Primitives;
|
||||||
|
using Avalonia.Input.Platform;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
|
public partial class IconDemo : UserControl
|
||||||
|
{
|
||||||
|
private IClipboard? _clipboard;
|
||||||
|
private WindowNotificationManager? _windowNotificationManager;
|
||||||
|
|
||||||
|
public IconDemo()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = new IconDemoViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate(e);
|
||||||
|
var vm = this.DataContext as IconDemoViewModel;
|
||||||
|
await Dispatcher.UIThread.InvokeAsync(() => { vm?.InitializeResources(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnAttachedToVisualTree(e);
|
||||||
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
|
_windowNotificationManager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
|
||||||
|
_clipboard = topLevel?.Clipboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Clicked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_clipboard is null) return;
|
||||||
|
if (sender is not Button { DataContext: IconItem s }) return;
|
||||||
|
await _clipboard.SetTextAsync(s.ResourceKey);
|
||||||
|
_windowNotificationManager?.Show(
|
||||||
|
new Notification("Copied", s.ResourceKey),
|
||||||
|
NotificationType.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,12 +31,12 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Width="32"
|
Width="32"
|
||||||
Height="32"
|
Height="32"
|
||||||
Data="M10.6201 17.5C6.06377 17.5 2.37012 13.8063 2.37012 9.25C2.37012 4.69365 6.06377 1 10.6201 1V17.5ZM13.3701 6.5C17.9265 6.5 21.6201 10.1936 21.6201 14.75C21.6201 19.3063 17.9265 23 13.3701 23V6.5Z" />
|
Data="{StaticResource SemiIconSemiLogo}" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="10"
|
Width="10"
|
||||||
Height="10"
|
Height="10"
|
||||||
Margin="20,0"
|
Margin="20,0"
|
||||||
Data="M20.5 13.5C21.3284 13.5 22 12.8284 22 12C22 11.1716 21.3284 10.5 20.5 10.5L13.5 10.5L13.5 3.5C13.5 2.67157 12.8284 2 12 2C11.1716 2 10.5 2.67157 10.5 3.5L10.5 10.5L3.5 10.5C2.67157 10.5 2 11.1716 2 12C2 12.8284 2.67157 13.5 3.5 13.5L10.5 13.5V20.5C10.5 21.3284 11.1716 22 12 22C12.8284 22 13.5 21.3284 13.5 20.5V13.5L20.5 13.5Z" />
|
Data="{StaticResource SemiIconPlus}" />
|
||||||
<Image Width="32" Height="32">
|
<Image Width="32" Height="32">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<DrawingImage>
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ public partial class Overview : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.2.1";
|
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.2.1.4";
|
||||||
|
|
||||||
public string MainStyle { get; set; } =
|
public string MainStyle { get; set; } =
|
||||||
"""
|
"""
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<!-- You can still reference in old way. -->
|
<!-- You can still reference in old way. -->
|
||||||
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
|
<!-- <StyleInclude Source="avares://Semi.Avalonia/Index.axaml" /> -->
|
||||||
<semi:SemiTheme Locale="zh-cn" />
|
<semi:SemiTheme Locale="zh-CN" />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
""";
|
""";
|
||||||
|
|
||||||
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.2.1";
|
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.2.1.4";
|
||||||
|
|
||||||
public string ColorPickerStyle { get; set; } =
|
public string ColorPickerStyle { get; set; } =
|
||||||
"""
|
"""
|
||||||
@@ -29,7 +29,7 @@ public partial class Overview : UserControl
|
|||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
""";
|
""";
|
||||||
|
|
||||||
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.2.1";
|
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.2.1.4";
|
||||||
|
|
||||||
public string DataGridStyle { get; set; } =
|
public string DataGridStyle { get; set; } =
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -14,17 +14,6 @@
|
|||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<viewModels:PaletteDemoViewModel />
|
<viewModels:PaletteDemoViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<UserControl.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
<ResourceInclude Source="../Themes/ToggleButton.axaml" />
|
|
||||||
<ResourceInclude Source="../Controls/ColorItemControl.axaml" />
|
|
||||||
<ResourceInclude Source="../Controls/ColorDetailControl.axaml" />
|
|
||||||
<ResourceInclude Source="../Controls/FunctionalColorGroupControl.axaml" />
|
|
||||||
<ResourceInclude Source="../Controls/ShadowGroupControl.axaml" />
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<SplitView
|
<SplitView
|
||||||
Name="splitView"
|
Name="splitView"
|
||||||
CompactPaneLength="50"
|
CompactPaneLength="50"
|
||||||
@@ -34,11 +23,12 @@
|
|||||||
PanePlacement="Right">
|
PanePlacement="Right">
|
||||||
<SplitView.Pane>
|
<SplitView.Pane>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<ToggleButton
|
<ToggleSwitch
|
||||||
Name="toggle"
|
Name="toggle"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
IsChecked="True"
|
IsChecked="True"
|
||||||
Theme="{DynamicResource SplitViewToggleButton}" />
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
|
Content="{StaticResource SemiIconSidebar}" />
|
||||||
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
|
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using Semi.Avalonia.Demo.ViewModels;
|
using Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
@@ -16,13 +14,20 @@ public partial class PaletteDemo : UserControl
|
|||||||
this.DataContext = new PaletteDemoViewModel();
|
this.DataContext = new PaletteDemoViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
PaletteDemoViewModel? vm = this.DataContext as PaletteDemoViewModel;
|
PaletteDemoViewModel? vm = this.DataContext as PaletteDemoViewModel;
|
||||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
await Dispatcher.UIThread.InvokeAsync(() => { vm?.InitializeResources(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Copy(object? o)
|
||||||
|
{
|
||||||
|
if (o is null) return;
|
||||||
|
var toplevel = TopLevel.GetTopLevel(this);
|
||||||
|
if (toplevel?.Clipboard is { } c)
|
||||||
{
|
{
|
||||||
vm?.InitializeResources();
|
await c.SetTextAsync(o.ToString());
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,30 @@
|
|||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel HorizontalAlignment="Left" >
|
<StackPanel HorizontalAlignment="Left">
|
||||||
<TextBlock Text="Size"></TextBlock>
|
<StackPanel Orientation="Horizontal">
|
||||||
<Slider Name="width" Minimum="0" Maximum="100" Value="20" Width="300"></Slider>
|
<StackPanel.Styles>
|
||||||
<ToggleSwitch Name="active" Content="Active"></ToggleSwitch>
|
<Style Selector="PathIcon">
|
||||||
|
<Setter Property="Theme" Value="{DynamicResource InnerPathIcon}" />
|
||||||
|
<Setter Property="Data" Value="{StaticResource SemiIconSearch}" />
|
||||||
|
</Style>
|
||||||
|
</StackPanel.Styles>
|
||||||
|
<PathIcon Classes="ExtraSmall" />
|
||||||
|
<PathIcon Classes="Small" />
|
||||||
|
<PathIcon />
|
||||||
|
<PathIcon Classes="Large" />
|
||||||
|
<PathIcon Classes="ExtraLarge" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="Size" />
|
||||||
|
<Slider Name="width" Minimum="0" Maximum="100" Value="20" Width="300" />
|
||||||
|
<ToggleSwitch Name="active" Content="Active" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Classes.Active="{Binding ElementName=active, Path=IsChecked}"
|
Classes.Active="{Binding #active.IsChecked}"
|
||||||
BorderBrush="{DynamicResource SemiRed6}"
|
|
||||||
Width="{Binding #width.Value}"
|
Width="{Binding #width.Value}"
|
||||||
Height="{Binding #width.Value}"
|
Height="{Binding #width.Value}"
|
||||||
Data="M12 3L2 12H5V20H19V12H22L12 3M13 18H11V16H13V18M13 14H11V8H13V14Z"
|
Foreground="{DynamicResource SemiBlue6}"
|
||||||
Foreground="{DynamicResource SemiBlue6}" />
|
BorderBrush="{DynamicResource SemiRed6}"
|
||||||
|
Data="{StaticResource SemiIconHome}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -11,11 +11,6 @@
|
|||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<pages:SplitViewDemoViewModel />
|
<pages:SplitViewDemoViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<UserControl.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<StreamGeometry x:Key="NavigationMenuExpandIconGlyph">M5 2H19C20.6569 2 22 3.34315 22 5V19C22 20.6569 20.6569 22 19 22H5C3.34315 22 2 20.6569 2 19V5C2 3.34315 3.34315 2 5 2ZM6 4C5.44772 4 5 4.44772 5 5V19C5 19.5523 5.44772 20 6 20H9C9.55229 20 10 19.5523 10 19V5C10 4.44772 9.55229 4 9 4H6Z</StreamGeometry>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<Border>
|
<Border>
|
||||||
<Grid ColumnDefinitions="*,400">
|
<Grid ColumnDefinitions="*,400">
|
||||||
<Border Grid.Column="1" VerticalAlignment="Top" Margin="10 0 0 0">
|
<Border Grid.Column="1" VerticalAlignment="Top" Margin="10 0 0 0">
|
||||||
@@ -114,20 +109,10 @@
|
|||||||
ItemsSource="{Binding Songs}" />
|
ItemsSource="{Binding Songs}" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Theme="{DynamicResource ButtonToggleSwitch}"
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
|
Content="{StaticResource SemiIconSidebar}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
IsChecked="{Binding #SplitView.IsPaneOpen}">
|
IsChecked="{Binding #SplitView.IsPaneOpen}">
|
||||||
<ToggleSwitch.OnContent>
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="{StaticResource NavigationMenuExpandIconGlyph}" />
|
|
||||||
</ToggleSwitch.OnContent>
|
|
||||||
<ToggleSwitch.OffContent>
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="{StaticResource NavigationMenuExpandIconGlyph}" />
|
|
||||||
</ToggleSwitch.OffContent>
|
|
||||||
</ToggleSwitch>
|
</ToggleSwitch>
|
||||||
</Grid>
|
</Grid>
|
||||||
</SplitView.Pane>
|
</SplitView.Pane>
|
||||||
|
|||||||
@@ -4,80 +4,56 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:system="clr-namespace:System;assembly=netstandard"
|
|
||||||
d:DesignHeight="800"
|
d:DesignHeight="800"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||||
<TextBox Width="300" />
|
<TextBox Width="300" />
|
||||||
<TextBox Width="300" Classes="Large" />
|
<TextBox Width="300" InnerLeftContent="https://" InnerRightContent=".com" />
|
||||||
<TextBox Width="300" Classes="Small" />
|
<TextBox Width="300" Classes="clearButton" Text="click to clear" />
|
||||||
<TextBox Width="300" Watermark="Please use this" />
|
<TextBox Width="300" Classes="revealPasswordButton" Text="123456" />
|
||||||
<TextBox Width="300" InnerLeftContent="http://" />
|
|
||||||
<TextBox Width="300" InnerRightContent=".com" />
|
|
||||||
<TextBox
|
|
||||||
Width="500"
|
|
||||||
InnerLeftContent="http://"
|
|
||||||
InnerRightContent=".com" />
|
|
||||||
<TextBox Width="300" Classes="clearButton" />
|
|
||||||
<TextBox Width="300" PasswordChar="*" />
|
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="300"
|
Width="300"
|
||||||
Classes="ClearButton RevealPasswordButton"
|
Classes="ClearButton RevealPasswordButton"
|
||||||
PasswordChar="*"
|
InnerLeftContent="https://"
|
||||||
|
InnerRightContent=".com"
|
||||||
Text="123456" />
|
Text="123456" />
|
||||||
<TextBox
|
|
||||||
Width="500"
|
|
||||||
InnerLeftContent="http://"
|
|
||||||
InnerRightContent=".com"
|
|
||||||
IsEnabled="False" />
|
|
||||||
<TextBox
|
|
||||||
Width="500"
|
|
||||||
Classes="Bordered"
|
|
||||||
InnerLeftContent="http://"
|
|
||||||
InnerRightContent=".com" />
|
|
||||||
<TextBox
|
|
||||||
Width="500"
|
|
||||||
Classes="Bordered"
|
|
||||||
InnerLeftContent="http://"
|
|
||||||
InnerRightContent=".com"
|
|
||||||
IsEnabled="False" />
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
Classes="Large"
|
Classes="Large"
|
||||||
Watermark="Large" />
|
Watermark="Large" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
Watermark="Default" />
|
Watermark="Default" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
Watermark="Small" />
|
Watermark="Small" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
Watermark="Disabled" />
|
Watermark="Disabled" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
Classes="Bordered"
|
Classes="Bordered"
|
||||||
Watermark="Bordered" />
|
Watermark="Bordered" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="150"
|
Width="100"
|
||||||
Classes="Bordered"
|
Classes="Bordered"
|
||||||
IsEnabled="False" />
|
IsEnabled="False" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBox Width="300" Classes="TextArea" />
|
<TextBox Width="300" Classes="TextArea" Watermark="TextArea TextBox" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="300"
|
Width="300"
|
||||||
Theme="{StaticResource LooklessTextBox}"
|
Theme="{StaticResource LooklessTextBox}"
|
||||||
Watermark="Lookless TextBox"
|
Watermark="Lookless TextBox"
|
||||||
InnerLeftContent="http://"
|
InnerLeftContent="https://"
|
||||||
InnerRightContent=".com" />
|
InnerRightContent=".com" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -4,18 +4,36 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
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.Pages"
|
||||||
|
x:DataType="vm:ThemeVariantDemoViewModel"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid>
|
<Design.DataContext>
|
||||||
<ThemeVariantScope Name="scope">
|
<vm:ThemeVariantDemoViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<StackPanel>
|
||||||
|
<Border Theme="{StaticResource CardBorder}">
|
||||||
|
<StackPanel>
|
||||||
|
<ListBox
|
||||||
|
Theme="{StaticResource CardRadioGroupListBox}"
|
||||||
|
ItemsSource="{Binding ThemeVariants}"
|
||||||
|
SelectedItem="{Binding SelectedThemeVariant}" />
|
||||||
|
<DatePicker />
|
||||||
|
<CalendarDatePicker />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
<ThemeVariantScope RequestedThemeVariant="{Binding SelectedThemeVariant}">
|
||||||
<Border Theme="{StaticResource CardBorder}">
|
<Border Theme="{StaticResource CardBorder}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
<ListBox
|
||||||
|
Theme="{StaticResource CardRadioGroupListBox}"
|
||||||
|
ItemsSource="{Binding ThemeVariants}"
|
||||||
|
SelectedItem="{Binding SelectedThemeVariant}" />
|
||||||
<DatePicker />
|
<DatePicker />
|
||||||
<CalendarDatePicker />
|
<CalendarDatePicker />
|
||||||
<ToggleSwitch Content="Switch Theme" IsCheckedChanged="Switch_OnIsCheckedChanged" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</ThemeVariantScope>
|
</ThemeVariantScope>
|
||||||
</Grid>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
using Avalonia;
|
using System.Collections.Generic;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Pages;
|
namespace Semi.Avalonia.Demo.Pages;
|
||||||
|
|
||||||
@@ -11,10 +10,22 @@ public partial class ThemeVariantDemo : UserControl
|
|||||||
public ThemeVariantDemo()
|
public ThemeVariantDemo()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.DataContext = new ThemeVariantDemoViewModel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Switch_OnIsCheckedChanged(object sender, RoutedEventArgs e)
|
public partial class ThemeVariantDemoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
scope.RequestedThemeVariant = scope.ActualThemeVariant == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
[ObservableProperty] private ThemeVariant? _selectedThemeVariant;
|
||||||
}
|
|
||||||
|
public IEnumerable<ThemeVariant> ThemeVariants =>
|
||||||
|
[
|
||||||
|
ThemeVariant.Default,
|
||||||
|
ThemeVariant.Light,
|
||||||
|
ThemeVariant.Dark,
|
||||||
|
SemiTheme.Aquatic,
|
||||||
|
SemiTheme.Desert,
|
||||||
|
SemiTheme.Dusk,
|
||||||
|
SemiTheme.NightSky,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
@@ -8,22 +8,23 @@
|
|||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel Spacing="8" Margin="20">
|
<StackPanel Spacing="8" Margin="20">
|
||||||
<ToggleSwitch
|
<StackPanel Orientation="Horizontal">
|
||||||
Content="Content"
|
<StackPanel>
|
||||||
OffContent="OffContent"
|
<ToggleSwitch />
|
||||||
OnContent="OnContent" />
|
<ToggleSwitch IsChecked="True" />
|
||||||
<ToggleSwitch
|
</StackPanel>
|
||||||
Content="Content"
|
<StackPanel>
|
||||||
IsChecked="True"
|
<ToggleSwitch IsEnabled="False" />
|
||||||
IsEnabled="False"
|
<ToggleSwitch IsChecked="True" IsEnabled="False" />
|
||||||
OffContent="OffContent"
|
</StackPanel>
|
||||||
OnContent="OnContent" />
|
</StackPanel>
|
||||||
<ToggleSwitch
|
<StackPanel Orientation="Horizontal">
|
||||||
Content="Content"
|
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" />
|
||||||
IsChecked="False"
|
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsChecked="True" />
|
||||||
IsEnabled="False"
|
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsEnabled="False" />
|
||||||
OffContent="OffContent"
|
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsEnabled="False" IsChecked="True" />
|
||||||
OnContent="OnContent" />
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" />
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" />
|
||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" IsChecked="True" />
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" IsChecked="True" />
|
||||||
@@ -44,8 +45,8 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开"/>
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" />
|
||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="〇" OnContent="|"/>
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="〇" OnContent="|" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" IsChecked="True" />
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" IsChecked="True" />
|
||||||
@@ -60,21 +61,39 @@
|
|||||||
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="〇" OnContent="|" Classes="Large" IsChecked="True" />
|
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="〇" OnContent="|" Classes="Large" IsChecked="True" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ToggleSwitch Theme="{DynamicResource ButtonToggleSwitch}">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ToggleSwitch.OnContent>
|
<ToggleSwitch
|
||||||
<PathIcon
|
HorizontalAlignment="Left"
|
||||||
Width="16"
|
Padding="{StaticResource SemiThicknessTight}"
|
||||||
Height="16"
|
Width="{StaticResource SemiSpacingExtraLoose}"
|
||||||
Data="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13"
|
Height="{StaticResource SemiSpacingExtraLoose}"
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
Theme="{DynamicResource ButtonToggleSwitch}"
|
||||||
</ToggleSwitch.OnContent>
|
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}">
|
||||||
<ToggleSwitch.OffContent>
|
<ToggleSwitch.Content>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
Data="{StaticResource SemiIconSidebar}" />
|
||||||
Data="M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17 15C17.476 15 17.9408 14.9525 18.3901 14.862C17.296 17.3011 14.8464 19 12 19C8.13401 19 5 15.866 5 12C5 8.60996 7.40983 5.78277 10.6099 5.13803C10.218 6.01173 10 6.98041 10 8C10 11.866 13.134 15 17 15Z"
|
</ToggleSwitch.Content>
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
</ToggleSwitch>
|
||||||
</ToggleSwitch.OffContent>
|
<ToggleSwitch
|
||||||
</ToggleSwitch>
|
HorizontalAlignment="Left"
|
||||||
|
Padding="{StaticResource SemiThicknessTight}"
|
||||||
|
Width="{StaticResource SemiSpacingExtraLoose}"
|
||||||
|
Height="{StaticResource SemiSpacingExtraLoose}"
|
||||||
|
Theme="{DynamicResource ButtonToggleSwitch}"
|
||||||
|
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}">
|
||||||
|
<ToggleSwitch.OnContent>
|
||||||
|
<PathIcon
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
|
Data="{StaticResource SemiIconSun}" />
|
||||||
|
</ToggleSwitch.OnContent>
|
||||||
|
<ToggleSwitch.OffContent>
|
||||||
|
<PathIcon
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
|
Data="{StaticResource SemiIconMoon}" />
|
||||||
|
</ToggleSwitch.OffContent>
|
||||||
|
</ToggleSwitch>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
94
demo/Semi.Avalonia.Demo/Pages/VariablesDemo.axaml
Normal file
94
demo/Semi.Avalonia.Demo/Pages/VariablesDemo.axaml
Normal 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>
|
||||||
24
demo/Semi.Avalonia.Demo/Pages/VariablesDemo.axaml.cs
Normal file
24
demo/Semi.Avalonia.Demo/Pages/VariablesDemo.axaml.cs
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,22 +4,26 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
|
||||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
|
||||||
|
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)"/>
|
||||||
<!--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 Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)">
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)" />
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<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\Semi.Avalonia.csproj" />
|
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,12 +2,9 @@
|
|||||||
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"
|
||||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
x:CompileBindings="True">
|
||||||
x:CompileBindings="True"
|
|
||||||
x:DataType="viewModels:ColorItemViewModel">
|
|
||||||
<StreamGeometry x:Key="CopyIcon">M5 7C3.89543 7 3 7.89543 3 9V19C3 20.1046 3.89543 21 5 21H15C16.1046 21 17 20.1046 17 19V9C17 7.89543 16.1046 7 15 7H5Z,M7 4C7 2.89543 7.89543 2 9 2H20C21.1046 2 22 2.89543 22 4V15C22 16.1046 21.1046 17 20 17H19V8C19 6 18 5 16 5H7V4Z</StreamGeometry>
|
|
||||||
<ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl">
|
<ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl">
|
||||||
<Setter Property="controls:ColorDetailControl.Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="controls:ColorDetailControl">
|
<ControlTemplate TargetType="controls:ColorDetailControl">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -20,7 +17,7 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
CornerRadius="6" />
|
CornerRadius="6" />
|
||||||
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *, *, *, *, *">
|
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *, *, *, *, *, *">
|
||||||
<!-- Row 0-1-2 ResourceKey -->
|
<!-- Row 0-1-2 ResourceKey -->
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -37,38 +34,26 @@
|
|||||||
<Button
|
<Button
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Classes="Tertiary"
|
|
||||||
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
||||||
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ResourceKey}"
|
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ResourceKey}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
<PathIcon
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
Width="12"
|
|
||||||
Height="12"
|
|
||||||
Data="{StaticResource CopyIcon}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
|
||||||
</Button>
|
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
|
IsVisible="{TemplateBinding ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||||
Text="{TemplateBinding ColorResourceKey}" />
|
Text="{TemplateBinding ColorResourceKey}" />
|
||||||
<Button
|
<Button
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Classes="Tertiary"
|
|
||||||
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
||||||
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ColorResourceKey}"
|
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ColorResourceKey}"
|
||||||
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
|
IsVisible="{TemplateBinding ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
<PathIcon
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
Width="12"
|
|
||||||
Height="12"
|
|
||||||
Data="{StaticResource CopyIcon}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<!-- Row 3-4 HEX -->
|
<!-- Row 3-4-5 HEX -->
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -76,7 +61,7 @@
|
|||||||
Margin="4,8,0,0"
|
Margin="4,8,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Tertiary"
|
Classes="Tertiary"
|
||||||
Text="ARGB" />
|
Text="Hex" />
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -85,47 +70,48 @@
|
|||||||
<Button
|
<Button
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Classes="Tertiary"
|
|
||||||
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
||||||
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Hex}"
|
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Hex}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
<PathIcon
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
Width="12"
|
<SelectableTextBlock
|
||||||
Height="12"
|
|
||||||
Data="{StaticResource CopyIcon}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<!-- Row 5-6 Opacity -->
|
|
||||||
<TextBlock
|
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{TemplateBinding Hex2}" />
|
||||||
|
<Button
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
||||||
|
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Hex2}"
|
||||||
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
|
|
||||||
|
<!-- Row 6-7 Opacity -->
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="0"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Margin="4,8,0,0"
|
Margin="4,8,0,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Tertiary"
|
Classes="Tertiary"
|
||||||
Text="Opacity" />
|
Text="Opacity" />
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Grid.Row="6"
|
Grid.Row="7"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{TemplateBinding OpacityNumber}" />
|
Text="{TemplateBinding OpacityNumber}" />
|
||||||
<Button
|
<Button
|
||||||
Grid.Row="6"
|
Grid.Row="7"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Classes="Tertiary"
|
|
||||||
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
|
||||||
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Opacity}"
|
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Opacity}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
<PathIcon
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
Width="12"
|
|
||||||
Height="12"
|
|
||||||
Data="{StaticResource CopyIcon}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -2,24 +2,23 @@
|
|||||||
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"
|
||||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
x:CompileBindings="True">
|
||||||
x:CompileBindings="True"
|
|
||||||
x:DataType="viewModels:ColorItemViewModel">
|
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<controls:ColorItemControl />
|
<controls:ColorItemControl />
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type controls:ColorItemControl}" TargetType="controls:ColorItemControl">
|
<ControlTheme x:Key="{x:Type controls:ColorItemControl}" TargetType="controls:ColorItemControl">
|
||||||
<Setter Property="controls:ColorItemControl.Width" Value="120" />
|
<Setter Property="Width" Value="120" />
|
||||||
<Setter Property="controls:ColorItemControl.Height" Value="60" />
|
<Setter Property="Height" Value="60" />
|
||||||
<Setter Property="controls:ColorItemControl.Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="controls:ColorItemControl.Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="controls:ColorItemControl">
|
<ControlTemplate TargetType="controls:ColorItemControl">
|
||||||
<!-- -->
|
|
||||||
<Border
|
<Border
|
||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
Height="{TemplateBinding Height}"
|
Height="{TemplateBinding Height}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -42,7 +41,7 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ TextBlock#PART_HexTextBlock">
|
<Style Selector="^:pointerover /template/ TextBlock#PART_HexTextBlock">
|
||||||
<Setter Property="TextBlock.IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
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"
|
||||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
|
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
x:DataType="viewModels:FunctionalColorGroupViewModel">
|
x:DataType="viewModels:FunctionalColorGroupViewModel">
|
||||||
<ControlTheme x:Key="{x:Type controls:FunctionalColorGroupControl}" TargetType="controls:FunctionalColorGroupControl">
|
<ControlTheme x:Key="{x:Type controls:FunctionalColorGroupControl}" TargetType="controls:FunctionalColorGroupControl">
|
||||||
@@ -30,27 +31,21 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Width="*" Header="ResourceKey">
|
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding ResourceKey}" />
|
Text="{Binding ResourceKey}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn
|
|
||||||
Width="*"
|
|
||||||
x:DataType="viewModels:ColorItemViewModel"
|
|
||||||
Binding="{Binding ColorDisplayName}"
|
|
||||||
CanUserSort="False"
|
|
||||||
Header="Name" />
|
|
||||||
<DataGridTemplateColumn Width="100" Header="Hex">
|
<DataGridTemplateColumn Width="100" Header="Hex">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Hex}" />
|
Text="{Binding Hex}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -60,13 +55,29 @@
|
|||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Brush.Opacity}" />
|
Text="{Binding Brush.Opacity}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</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.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -84,27 +95,21 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Width="*" Header="ResourceKey">
|
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding ResourceKey}" />
|
Text="{Binding ResourceKey}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn
|
|
||||||
Width="*"
|
|
||||||
x:DataType="viewModels:ColorItemViewModel"
|
|
||||||
Binding="{Binding ColorDisplayName}"
|
|
||||||
CanUserSort="False"
|
|
||||||
Header="Name" />
|
|
||||||
<DataGridTemplateColumn Width="100" Header="Hex">
|
<DataGridTemplateColumn Width="100" Header="Hex">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Hex}" />
|
Text="{Binding Hex}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -114,13 +119,29 @@
|
|||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Brush.Opacity}" />
|
Text="{Binding Brush.Opacity}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</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.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
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"
|
||||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||||
|
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
x:DataType="viewModels:ShadowGroupViewModel">
|
x:DataType="viewModels:ShadowGroupViewModel">
|
||||||
<ControlTheme x:Key="{x:Type controls:ShadowGroupControl}" TargetType="controls:ShadowGroupControl">
|
<ControlTheme x:Key="{x:Type controls:ShadowGroupControl}" TargetType="controls:ShadowGroupControl">
|
||||||
@@ -19,29 +20,40 @@
|
|||||||
<TabItem Header="Light">
|
<TabItem Header="Light">
|
||||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightShadows}">
|
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightShadows}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTemplateColumn Width="*" Header="ResourceKey">
|
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding ResourceKey}" />
|
Text="{Binding ResourceKey}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</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
|
<DataGridTextColumn
|
||||||
Width="*"
|
Width="*"
|
||||||
x:DataType="viewModels:ShadowItemViewModel"
|
x:DataType="viewModels:ShadowItemViewModel"
|
||||||
Binding="{Binding ShadowDisplayName}"
|
Binding="{Binding ShadowDisplayName}"
|
||||||
CanUserSort="False"
|
CanUserSort="False"
|
||||||
Header="Name" />
|
Header="Description" />
|
||||||
<DataGridTemplateColumn Width="300" Header="BoxShadows">
|
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||||
<SelectableTextBlock
|
<Button
|
||||||
Margin="12,0,12,0"
|
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||||
VerticalAlignment="Center"
|
CommandParameter="{Binding CopyText}"
|
||||||
Text="{Binding BoxShadowValue}" />
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
@@ -51,29 +63,40 @@
|
|||||||
<TabItem Header="Dark">
|
<TabItem Header="Dark">
|
||||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkShadows}">
|
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkShadows}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTemplateColumn Width="*" Header="ResourceKey">
|
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||||
<SelectableTextBlock
|
<SelectableTextBlock
|
||||||
Margin="12,0,12,0"
|
Margin="12,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding ResourceKey}" />
|
Text="{Binding ResourceKey}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</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
|
<DataGridTextColumn
|
||||||
Width="*"
|
Width="*"
|
||||||
x:DataType="viewModels:ShadowItemViewModel"
|
x:DataType="viewModels:ShadowItemViewModel"
|
||||||
Binding="{Binding ShadowDisplayName}"
|
Binding="{Binding ShadowDisplayName}"
|
||||||
CanUserSort="False"
|
CanUserSort="False"
|
||||||
Header="Name" />
|
Header="Description" />
|
||||||
<DataGridTemplateColumn Width="300" Header="BoxShadows">
|
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||||
<SelectableTextBlock
|
<Button
|
||||||
Margin="12,0,12,0"
|
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||||
VerticalAlignment="Center"
|
CommandParameter="{Binding CopyText}"
|
||||||
Text="{Binding BoxShadowValue}" />
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Content="{StaticResource SemiIconCopy}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<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">
|
||||||
<ControlTheme x:Key="NavigationTab" TargetType="TabControl">
|
<ControlTheme x:Key="NavigationTab" TargetType="TabControl">
|
||||||
<Setter Property="TabControl.Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="TabControl">
|
<ControlTemplate TargetType="TabControl">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
@@ -10,7 +10,10 @@
|
|||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ScrollViewer DockPanel.Dock="Left" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Name="PART_ScrollViewer"
|
||||||
|
VerticalScrollBarVisibility="Auto">
|
||||||
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
||||||
<ItemsPresenter Name="PART_ItemsPresenter">
|
<ItemsPresenter Name="PART_ItemsPresenter">
|
||||||
<ItemsPresenter.ItemsPanel>
|
<ItemsPresenter.ItemsPanel>
|
||||||
@@ -19,7 +22,8 @@
|
|||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ItemsPresenter.ItemsPanel>
|
</ItemsPresenter.ItemsPanel>
|
||||||
</ItemsPresenter>
|
</ItemsPresenter>
|
||||||
<Border Name="PART_BorderSeparator" Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
<Border Name="PART_BorderSeparator"
|
||||||
|
Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
@@ -38,5 +42,8 @@
|
|||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="^.Dismiss /template/ ScrollViewer#PART_ScrollViewer">
|
||||||
|
<Setter Property="IsVisible" Value="False" />
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<ControlTheme x:Key="SplitViewToggleButton" TargetType="ToggleButton">
|
|
||||||
<Setter Property="ToggleButton.Template">
|
|
||||||
<ControlTemplate TargetType="ToggleButton">
|
|
||||||
<Border
|
|
||||||
Name="Background"
|
|
||||||
Padding="8"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
CornerRadius="3">
|
|
||||||
<PathIcon
|
|
||||||
Name="Icon"
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="M5 2H19C20.6569 2 22 3.34315 22 5V19C22 20.6569 20.6569 22 19 22H5C3.34315 22 2 20.6569 2 19V5C2 3.34315 3.34315 2 5 2ZM6 4C5.44772 4 5 4.44772 5 5V19C5 19.5523 5.44772 20 6 20H9C9.55229 20 10 19.5523 10 19V5C10 4.44772 9.55229 4 9 4H6Z"
|
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
</ResourceDictionary>
|
|
||||||
46
demo/Semi.Avalonia.Demo/Themes/ToggleSwitch.axaml
Normal file
46
demo/Semi.Avalonia.Demo/Themes/ToggleSwitch.axaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch
|
||||||
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
|
Content="{StaticResource SemiIconStar}" />
|
||||||
|
<Button
|
||||||
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Content="{StaticResource SemiIconStar}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="IconBorderlessToggleSwitch"
|
||||||
|
BasedOn="{StaticResource ButtonToggleSwitch}"
|
||||||
|
TargetType="ToggleSwitch">
|
||||||
|
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
|
||||||
|
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
|
||||||
|
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
|
||||||
|
<Setter Property="OnContentTemplate">
|
||||||
|
<StaticResource ResourceKey="GeometryDataTemplate" />
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="OffContentTemplate">
|
||||||
|
<StaticResource ResourceKey="GeometryDataTemplate" />
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<StaticResource ResourceKey="GeometryDataTemplate" />
|
||||||
|
</Setter>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="IconBorderlessButton"
|
||||||
|
BasedOn="{StaticResource BorderlessButton}"
|
||||||
|
TargetType="Button">
|
||||||
|
<Setter Property="Padding" Value="{StaticResource SemiThicknessTight}" />
|
||||||
|
<Setter Property="Width" Value="{StaticResource SemiSpacingExtraLoose}" />
|
||||||
|
<Setter Property="Height" Value="{StaticResource SemiSpacingExtraLoose}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<StaticResource ResourceKey="GeometryDataTemplate" />
|
||||||
|
</Setter>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="GeometryDataTemplate" DataType="Geometry">
|
||||||
|
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ResourceDictionary>
|
||||||
10
demo/Semi.Avalonia.Demo/Themes/_index.axaml
Normal file
10
demo/Semi.Avalonia.Demo/Themes/_index.axaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceInclude Source="ColorDetailControl.axaml" />
|
||||||
|
<ResourceInclude Source="ColorItemControl.axaml" />
|
||||||
|
<ResourceInclude Source="FunctionalColorGroupControl.axaml" />
|
||||||
|
<ResourceInclude Source="ShadowGroupControl.axaml" />
|
||||||
|
<ResourceInclude Source="TabMenu.axaml" />
|
||||||
|
<ResourceInclude Source="ToggleSwitch.axaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
19
demo/Semi.Avalonia.Demo/ViewModels/ApplicationViewModel.cs
Normal file
19
demo/Semi.Avalonia.Demo/ViewModels/ApplicationViewModel.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Semi.Avalonia.Demo.Views;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public partial class ApplicationViewModel: ObservableObject
|
||||||
|
{
|
||||||
|
[RelayCommand]
|
||||||
|
private void Exit()
|
||||||
|
{
|
||||||
|
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
|
{
|
||||||
|
desktop.Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,14 +8,14 @@ using CommunityToolkit.Mvvm.Input;
|
|||||||
|
|
||||||
namespace Semi.Avalonia.Demo.ViewModels;
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
public class DataGridDemoViewModel: ObservableObject
|
public class DataGridDemoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
public ObservableCollection<Song> GridData1 { get; set; }
|
public ObservableCollection<Song> GridData1 { get; set; }
|
||||||
|
|
||||||
public DataGridCollectionView GridData2 { get; set; }
|
public DataGridCollectionView GridData2 { get; set; }
|
||||||
|
|
||||||
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
||||||
|
|
||||||
public RelayCommand AddCommand { get; set; }
|
public RelayCommand AddCommand { get; set; }
|
||||||
|
|
||||||
public DataGridDemoViewModel()
|
public DataGridDemoViewModel()
|
||||||
@@ -23,7 +23,7 @@ public class DataGridDemoViewModel: ObservableObject
|
|||||||
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
||||||
GridData2 = new DataGridCollectionView(Song.Songs);
|
GridData2 = new DataGridCollectionView(Song.Songs);
|
||||||
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
|
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
|
||||||
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a=>new SongViewModel()
|
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a => new SongViewModel()
|
||||||
{
|
{
|
||||||
Title = a.Title,
|
Title = a.Title,
|
||||||
Artist = a.Artist,
|
Artist = a.Artist,
|
||||||
@@ -57,11 +57,10 @@ public class Song
|
|||||||
Album = album;
|
Album = album;
|
||||||
CountOfComment = countOfComment;
|
CountOfComment = countOfComment;
|
||||||
Url = $"https://music.163.com/song?id={netEaseId}";
|
Url = $"https://music.163.com/song?id={netEaseId}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Song> Songs { get; set; } = new List<Song>()
|
public static List<Song> Songs =>
|
||||||
{
|
[
|
||||||
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
|
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
|
||||||
new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
|
new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
|
||||||
new("长大", "熊猫堂ProducePandas", 4, 6, "A.S.I.A", 1114, 1487037690),
|
new("长大", "熊猫堂ProducePandas", 4, 6, "A.S.I.A", 1114, 1487037690),
|
||||||
@@ -122,41 +121,15 @@ public class Song
|
|||||||
new("热带季风Remix", "熊猫堂ProducePandas", 3, 22, "W.O.R.L.D.", 23, 2063173319),
|
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", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
|
||||||
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
|
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
|
||||||
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775),
|
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775)
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SongViewModel: ObservableObject
|
public partial class SongViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private string? _title;
|
[ObservableProperty] private string? _title;
|
||||||
private string? _artist;
|
[ObservableProperty] private string? _artist;
|
||||||
private string? _album;
|
[ObservableProperty] private string? _album;
|
||||||
private int _countOfComment;
|
[ObservableProperty] private int _countOfComment;
|
||||||
private bool? _isSelected;
|
[ObservableProperty] private bool? _isSelected;
|
||||||
public string? Title
|
|
||||||
{
|
|
||||||
get => _title;
|
|
||||||
set => SetProperty(ref _title, value);
|
|
||||||
}
|
|
||||||
public string? Artist
|
|
||||||
{
|
|
||||||
get => _artist;
|
|
||||||
set => SetProperty(ref _artist, value);
|
|
||||||
}
|
|
||||||
public string? Album
|
|
||||||
{
|
|
||||||
get => _album;
|
|
||||||
set => SetProperty(ref _album, value);
|
|
||||||
}
|
|
||||||
public int CountOfComment
|
|
||||||
{
|
|
||||||
get => _countOfComment;
|
|
||||||
set => SetProperty(ref _countOfComment, value);
|
|
||||||
}
|
|
||||||
public bool? IsSelected
|
|
||||||
{
|
|
||||||
get => _isSelected;
|
|
||||||
set => SetProperty(ref _isSelected, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
133
demo/Semi.Avalonia.Demo/ViewModels/HighContrastDemoViewModel.cs
Normal file
133
demo/Semi.Avalonia.Demo/ViewModels/HighContrastDemoViewModel.cs
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Avalonia.Styling;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public partial class HighContrastDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty] private ThemeVariant? _selectedThemeVariant;
|
||||||
|
[ObservableProperty] private ColorResource _selectedColorResource = null!;
|
||||||
|
|
||||||
|
public IEnumerable<ThemeVariant> ThemeVariants { get; }
|
||||||
|
public ObservableCollection<ColorResource> ColorResources { get; set; }
|
||||||
|
|
||||||
|
public HighContrastDemoViewModel()
|
||||||
|
{
|
||||||
|
ThemeVariants =
|
||||||
|
[
|
||||||
|
SemiTheme.Aquatic,
|
||||||
|
SemiTheme.Desert,
|
||||||
|
SemiTheme.Dusk,
|
||||||
|
SemiTheme.NightSky,
|
||||||
|
];
|
||||||
|
ColorResources =
|
||||||
|
[
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorWindow",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#202020")),
|
||||||
|
Description = "Background of pages, panes, popups, and windows.",
|
||||||
|
PairWith = "WindowTextColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorWindowText",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#FFFFFF")),
|
||||||
|
Description = "Headings, body copy, lists, placeholder text, app and window borders.",
|
||||||
|
PairWith = "WindowColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorHotlight",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#75E9FC")),
|
||||||
|
Description = "Hyperlinks.",
|
||||||
|
PairWith = "WindowColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorGrayText",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#A6A6A6")),
|
||||||
|
Description = "Inactive (disabled) UI.",
|
||||||
|
PairWith = "WindowColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorHighlightText",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#263B50")),
|
||||||
|
Description =
|
||||||
|
"Foreground color for text or UI that is in selected, interacted with (hover, pressed), or in progress.",
|
||||||
|
PairWith = "HighlightColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorHighlight",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#8EE3F0")),
|
||||||
|
Description =
|
||||||
|
"Background or accent color for UI that is in selected, interacted with (hover, pressed), or in progress.",
|
||||||
|
PairWith = "HighlightTextColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorButtonText",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#FFFFFF")),
|
||||||
|
Description = "Foreground color for buttons and any UI that can be interacted with.",
|
||||||
|
PairWith = "ButtonFaceColor"
|
||||||
|
},
|
||||||
|
new ColorResource
|
||||||
|
{
|
||||||
|
ResourceKey = "SemiColorButtonFace",
|
||||||
|
Brush = new SolidColorBrush(Color.Parse("#202020")),
|
||||||
|
Description = "Background color for buttons and any UI that can be interacted with.",
|
||||||
|
PairWith = "ButtonTextColor"
|
||||||
|
},
|
||||||
|
];
|
||||||
|
WeakReferenceMessenger.Default.Register<HighContrastDemoViewModel, ColorResource>
|
||||||
|
(this, (_, item) => SelectedColorResource = item);
|
||||||
|
SelectedThemeVariant = SemiTheme.Aquatic;
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnSelectedThemeVariantChanged(ThemeVariant? value)
|
||||||
|
{
|
||||||
|
var topLevel = ResolveDefaultTopLevel();
|
||||||
|
if (value is null) return;
|
||||||
|
foreach (var colorResource in ColorResources)
|
||||||
|
{
|
||||||
|
if (colorResource.ResourceKey is null) continue;
|
||||||
|
if (topLevel?.TryFindResource(colorResource.ResourceKey, value, out var o) == true
|
||||||
|
&& o is ISolidColorBrush color)
|
||||||
|
{
|
||||||
|
colorResource.Brush = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TopLevel? ResolveDefaultTopLevel()
|
||||||
|
{
|
||||||
|
return Application.Current?.ApplicationLifetime switch
|
||||||
|
{
|
||||||
|
IClassicDesktopStyleApplicationLifetime desktopLifetime => desktopLifetime.MainWindow,
|
||||||
|
ISingleViewApplicationLifetime singleView => TopLevel.GetTopLevel(singleView.MainView),
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class ColorResource : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty] private string? _resourceKey;
|
||||||
|
[ObservableProperty] private ISolidColorBrush? _brush;
|
||||||
|
[ObservableProperty] private string? _description;
|
||||||
|
[ObservableProperty] private string? _pairWith;
|
||||||
|
|
||||||
|
public string CopyText =>
|
||||||
|
$"""
|
||||||
|
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||||
|
""";
|
||||||
|
}
|
||||||
71
demo/Semi.Avalonia.Demo/ViewModels/IconDemoViewModel.cs
Normal file
71
demo/Semi.Avalonia.Demo/ViewModels/IconDemoViewModel.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
|
public partial class IconDemoViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
private readonly IResourceDictionary? _resources = new Icons();
|
||||||
|
|
||||||
|
private readonly Dictionary<string, IconItem> _filledIcons = new();
|
||||||
|
private readonly Dictionary<string, IconItem> _strokedIcons = new();
|
||||||
|
|
||||||
|
[ObservableProperty] private string? _searchText;
|
||||||
|
|
||||||
|
public ObservableCollection<IconItem> FilteredFilledIcons { get; set; } = [];
|
||||||
|
public ObservableCollection<IconItem> FilteredStrokedIcons { get; set; } = [];
|
||||||
|
|
||||||
|
public void InitializeResources()
|
||||||
|
{
|
||||||
|
if (_resources is null) return;
|
||||||
|
|
||||||
|
foreach (var provider in _resources.MergedDictionaries)
|
||||||
|
{
|
||||||
|
if (provider is not ResourceDictionary dic) continue;
|
||||||
|
|
||||||
|
foreach (var key in dic.Keys)
|
||||||
|
{
|
||||||
|
if (dic[key] is not Geometry geometry) continue;
|
||||||
|
var icon = new IconItem
|
||||||
|
{
|
||||||
|
ResourceKey = key.ToString(),
|
||||||
|
Geometry = geometry
|
||||||
|
};
|
||||||
|
|
||||||
|
if (key.ToString().EndsWith("Stroked"))
|
||||||
|
_strokedIcons[key.ToString().ToLowerInvariant()] = icon;
|
||||||
|
else
|
||||||
|
_filledIcons[key.ToString().ToLowerInvariant()] = icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnSearchTextChanged(string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnSearchTextChanged(string? value)
|
||||||
|
{
|
||||||
|
var search = value?.ToLowerInvariant() ?? string.Empty;
|
||||||
|
|
||||||
|
FilteredFilledIcons.Clear();
|
||||||
|
foreach (var pair in _filledIcons.Where(i => i.Key.Contains(search)))
|
||||||
|
{
|
||||||
|
FilteredFilledIcons.Add(pair.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilteredStrokedIcons.Clear();
|
||||||
|
foreach (var pair in _strokedIcons.Where(i => i.Key.Contains(search)))
|
||||||
|
{
|
||||||
|
FilteredStrokedIcons.Add(pair.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IconItem
|
||||||
|
{
|
||||||
|
public string? ResourceKey { get; set; }
|
||||||
|
public Geometry? Geometry { get; set; }
|
||||||
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using Semi.Avalonia.Demo.Constant;
|
||||||
|
using Semi.Avalonia.Demo.Converters;
|
||||||
|
using Semi.Avalonia.Tokens.Palette;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.ViewModels;
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
public class PaletteDemoViewModel : ObservableObject
|
public partial class PaletteDemoViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private readonly string[] _predefinedColorNames =
|
private readonly string[] _predefinedColorNames =
|
||||||
[
|
[
|
||||||
@@ -21,39 +25,18 @@ public class PaletteDemoViewModel : ObservableObject
|
|||||||
private readonly IResourceDictionary? _lightResourceDictionary;
|
private readonly IResourceDictionary? _lightResourceDictionary;
|
||||||
private readonly IResourceDictionary? _darkResourceDictionary;
|
private readonly IResourceDictionary? _darkResourceDictionary;
|
||||||
|
|
||||||
private ColorItemViewModel _selectedColor = null!;
|
[ObservableProperty] private ColorItemViewModel? _selectedColor;
|
||||||
|
|
||||||
public ColorItemViewModel SelectedColor
|
|
||||||
{
|
|
||||||
get => _selectedColor;
|
|
||||||
set => SetProperty(ref _selectedColor, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ObservableCollection<ColorListViewModel>? _lightLists;
|
|
||||||
|
|
||||||
public ObservableCollection<ColorListViewModel>? LightLists
|
|
||||||
{
|
|
||||||
get => _lightLists;
|
|
||||||
set => SetProperty(ref _lightLists, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableCollection<ColorListViewModel>? _darkLists;
|
|
||||||
|
|
||||||
public ObservableCollection<ColorListViewModel>? DarkLists
|
|
||||||
{
|
|
||||||
get => _darkLists;
|
|
||||||
set => SetProperty(ref _darkLists, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public ObservableCollection<ColorListViewModel> LightLists { get; set; } = [];
|
||||||
|
public ObservableCollection<ColorListViewModel> DarkLists { get; set; } = [];
|
||||||
public ObservableCollection<FunctionalColorGroupViewModel> FunctionalColors { get; set; } = [];
|
public ObservableCollection<FunctionalColorGroupViewModel> FunctionalColors { get; set; } = [];
|
||||||
public ObservableCollection<ShadowGroupViewModel> Shadows { get; set; } = [];
|
public ObservableCollection<ShadowGroupViewModel> Shadows { get; set; } = [];
|
||||||
|
|
||||||
public PaletteDemoViewModel()
|
public PaletteDemoViewModel()
|
||||||
{
|
{
|
||||||
_lightResourceDictionary = new Light.Palette();
|
_lightResourceDictionary = new Light();
|
||||||
_darkResourceDictionary = new Dark.Palette();
|
_darkResourceDictionary = new Dark();
|
||||||
WeakReferenceMessenger.Default.Register<PaletteDemoViewModel, ColorItemViewModel>(this, OnClickColorItem);
|
WeakReferenceMessenger.Default.Register<ColorItemViewModel>(this, (_, item) => SelectedColor = item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitializeResources()
|
public void InitializeResources()
|
||||||
@@ -65,7 +48,6 @@ public class PaletteDemoViewModel : ObservableObject
|
|||||||
|
|
||||||
private void InitializePalette()
|
private void InitializePalette()
|
||||||
{
|
{
|
||||||
LightLists = [];
|
|
||||||
foreach (var color in _predefinedColorNames)
|
foreach (var color in _predefinedColorNames)
|
||||||
{
|
{
|
||||||
ColorListViewModel s = new ColorListViewModel();
|
ColorListViewModel s = new ColorListViewModel();
|
||||||
@@ -73,7 +55,6 @@ public class PaletteDemoViewModel : ObservableObject
|
|||||||
LightLists.Add(s);
|
LightLists.Add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
DarkLists = [];
|
|
||||||
foreach (var color in _predefinedColorNames)
|
foreach (var color in _predefinedColorNames)
|
||||||
{
|
{
|
||||||
ColorListViewModel s = new ColorListViewModel();
|
ColorListViewModel s = new ColorListViewModel();
|
||||||
@@ -84,126 +65,82 @@ public class PaletteDemoViewModel : ObservableObject
|
|||||||
|
|
||||||
private void InitializeFunctionalColors()
|
private void InitializeFunctionalColors()
|
||||||
{
|
{
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Primary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.PrimaryTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Secondary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SecondaryTokens));
|
"Primary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.PrimaryTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Tertiary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TertiaryTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Information", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.InformationTokens));
|
"Secondary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SecondaryTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Success", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SuccessTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens));
|
"Tertiary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TertiaryTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Danger", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DangerTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Text", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TextTokens));
|
"Information", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.InformationTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Link", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.LinkTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Background", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.BackgroundTokens));
|
"Success", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SuccessTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Fill", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.FillTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Border", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.BorderTokens));
|
"Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens));
|
||||||
FunctionalColors.Add(new FunctionalColorGroupViewModel("Disabled", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DisabledTokens));
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Danger", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DangerTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Text", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TextTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Link", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.LinkTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Background", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.BackgroundTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Fill", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.FillTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Border", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.BorderTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Disabled", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.DisabledTokens));
|
||||||
|
FunctionalColors.Add(new FunctionalColorGroupViewModel(
|
||||||
|
"Others", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.OtherTokens));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeShadows()
|
private void InitializeShadows()
|
||||||
{
|
{
|
||||||
Shadows.Add(new ShadowGroupViewModel("Shadow", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.ShadowTokens));
|
Shadows.Add(new ShadowGroupViewModel(
|
||||||
}
|
"Shadow", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.ShadowTokens));
|
||||||
|
|
||||||
private void OnClickColorItem(PaletteDemoViewModel vm, ColorItemViewModel item)
|
|
||||||
{
|
|
||||||
SelectedColor = item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ColorListViewModel : ObservableObject
|
public partial class ColorListViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private ObservableCollection<ColorItemViewModel>? _colors;
|
public ObservableCollection<ColorItemViewModel> Color { get; set; } = [];
|
||||||
|
|
||||||
public ObservableCollection<ColorItemViewModel>? Color
|
[ObservableProperty] private string? _seriesName;
|
||||||
{
|
|
||||||
get => _colors;
|
|
||||||
set => SetProperty(ref _colors, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string? _seriesName;
|
|
||||||
|
|
||||||
public string? SeriesName
|
|
||||||
{
|
|
||||||
get => _seriesName;
|
|
||||||
set => SetProperty(ref _seriesName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Initialize(IResourceDictionary? resourceDictionary, string color, bool light)
|
internal void Initialize(IResourceDictionary? resourceDictionary, string color, bool light)
|
||||||
{
|
{
|
||||||
if (resourceDictionary is null)
|
if (resourceDictionary is null) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SeriesName = color;
|
SeriesName = color;
|
||||||
Color = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < 10; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
var key = "Semi" + color + i;
|
var key = $"Semi{color}{i}";
|
||||||
if (resourceDictionary.TryGetValue(key, out var value))
|
if (resourceDictionary.TryGetValue(key, out var value) && value is ISolidColorBrush brush)
|
||||||
{
|
{
|
||||||
if (value is ISolidColorBrush brush)
|
var name = $"{color} {i}";
|
||||||
{
|
var item = new ColorItemViewModel(name, brush, key, light, i);
|
||||||
string name = color + " " + i;
|
item.ColorResourceKey = $"{item.ResourceKey}Color";
|
||||||
var item = new ColorItemViewModel(name, brush, key, light, i);
|
Color.Add(item);
|
||||||
item.ColorResourceKey = item.ResourceKey + "Color";
|
|
||||||
Color.Add(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ColorItemViewModel : ObservableObject
|
public partial class ColorItemViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private IBrush _brush = null!;
|
[ObservableProperty] private IBrush? _brush;
|
||||||
|
[ObservableProperty] private IBrush? _textBrush;
|
||||||
|
[ObservableProperty] private string? _colorDisplayName;
|
||||||
|
[ObservableProperty] private string? _resourceKey;
|
||||||
|
[ObservableProperty] private string? _colorResourceKey;
|
||||||
|
[ObservableProperty] private string? _hex;
|
||||||
|
|
||||||
public IBrush Brush
|
public string CopyText =>
|
||||||
{
|
$"""
|
||||||
get => _brush;
|
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||||
set => SetProperty(ref _brush, value);
|
""";
|
||||||
}
|
|
||||||
|
|
||||||
private IBrush _textBrush = null!;
|
|
||||||
|
|
||||||
public IBrush TextBrush
|
|
||||||
{
|
|
||||||
get => _textBrush;
|
|
||||||
set => SetProperty(ref _textBrush, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _colorDisplayName = null!;
|
|
||||||
|
|
||||||
public string ColorDisplayName
|
|
||||||
{
|
|
||||||
get => _colorDisplayName;
|
|
||||||
set => SetProperty(ref _colorDisplayName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _resourceKey = null!;
|
|
||||||
|
|
||||||
public string ResourceKey
|
|
||||||
{
|
|
||||||
get => _resourceKey;
|
|
||||||
set => SetProperty(ref _resourceKey, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _colorResourceKey = null!;
|
|
||||||
|
|
||||||
public string ColorResourceKey
|
|
||||||
{
|
|
||||||
get => _colorResourceKey;
|
|
||||||
set => SetProperty(ref _colorResourceKey, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _hex = null!;
|
|
||||||
|
|
||||||
public string Hex
|
|
||||||
{
|
|
||||||
get => _hex;
|
|
||||||
set => SetProperty(ref _hex, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
|
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
|
||||||
int index)
|
int index)
|
||||||
@@ -211,7 +148,8 @@ public class ColorItemViewModel : ObservableObject
|
|||||||
ColorDisplayName = colorDisplayName;
|
ColorDisplayName = colorDisplayName;
|
||||||
Brush = brush;
|
Brush = brush;
|
||||||
ResourceKey = resourceKey;
|
ResourceKey = resourceKey;
|
||||||
Hex = brush.ToString().ToUpperInvariant();
|
var hex = ColorConverter.ToHex.Convert(brush.Color, typeof(string), false, CultureInfo.InvariantCulture);
|
||||||
|
Hex = hex as string ?? string.Empty;
|
||||||
if ((light && index < 5) || (!light && index >= 5))
|
if ((light && index < 5) || (!light && index >= 5))
|
||||||
{
|
{
|
||||||
TextBrush = Brushes.Black;
|
TextBrush = Brushes.Black;
|
||||||
@@ -223,16 +161,9 @@ public class ColorItemViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FunctionalColorGroupViewModel : ObservableObject
|
public partial class FunctionalColorGroupViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private string _title = null!;
|
[ObservableProperty] private string? _title;
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get => _title;
|
|
||||||
set => SetProperty(ref _title, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<ColorItemViewModel> LightColors { get; set; } = [];
|
public ObservableCollection<ColorItemViewModel> LightColors { get; set; } = [];
|
||||||
public ObservableCollection<ColorItemViewModel> DarkColors { get; set; } = [];
|
public ObservableCollection<ColorItemViewModel> DarkColors { get; set; } = [];
|
||||||
|
|
||||||
@@ -261,31 +192,16 @@ public class FunctionalColorGroupViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShadowItemViewModel : ObservableObject
|
public partial class ShadowItemViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private string _shadowDisplayName = null!;
|
[ObservableProperty] private string? _shadowDisplayName;
|
||||||
|
[ObservableProperty] private string? _resourceKey;
|
||||||
|
[ObservableProperty] private string? _boxShadowValue;
|
||||||
|
|
||||||
public string ShadowDisplayName
|
public string CopyText =>
|
||||||
{
|
$"""
|
||||||
get => _shadowDisplayName;
|
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||||
set => SetProperty(ref _shadowDisplayName, value);
|
""";
|
||||||
}
|
|
||||||
|
|
||||||
private string _resourceKey = null!;
|
|
||||||
|
|
||||||
public string ResourceKey
|
|
||||||
{
|
|
||||||
get => _resourceKey;
|
|
||||||
set => SetProperty(ref _resourceKey, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _boxShadowValue = null!;
|
|
||||||
|
|
||||||
public string BoxShadowValue
|
|
||||||
{
|
|
||||||
get => _boxShadowValue;
|
|
||||||
set => SetProperty(ref _boxShadowValue, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShadowItemViewModel(string shadowDisplayName, BoxShadows boxShadows, string resourceKey)
|
public ShadowItemViewModel(string shadowDisplayName, BoxShadows boxShadows, string resourceKey)
|
||||||
{
|
{
|
||||||
@@ -295,16 +211,9 @@ public class ShadowItemViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShadowGroupViewModel : ObservableObject
|
public partial class ShadowGroupViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private string _title = null!;
|
[ObservableProperty] private string? _title;
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get => _title;
|
|
||||||
set => SetProperty(ref _title, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<ShadowItemViewModel> LightShadows { get; set; } = [];
|
public ObservableCollection<ShadowItemViewModel> LightShadows { get; set; } = [];
|
||||||
public ObservableCollection<ShadowItemViewModel> DarkShadows { get; set; } = [];
|
public ObservableCollection<ShadowItemViewModel> DarkShadows { get; set; } = [];
|
||||||
|
|
||||||
@@ -332,132 +241,4 @@ public class ShadowGroupViewModel : ObservableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static class ColorTokens
|
|
||||||
{
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> PrimaryTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorPrimary", "Primary"),
|
|
||||||
new("SemiColorPrimaryPointerover", "Primary Pointerover"),
|
|
||||||
new("SemiColorPrimaryActive", "Primary Active"),
|
|
||||||
new("SemiColorPrimaryDisabled", "Primary Disabled"),
|
|
||||||
new("SemiColorPrimaryLight", "Primary Light"),
|
|
||||||
new("SemiColorPrimaryLightPointerover", "Primary Light Pointerover"),
|
|
||||||
new("SemiColorPrimaryLightActive", "Primary Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> SecondaryTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorSecondary", "Secondary"),
|
|
||||||
new("SemiColorSecondaryPointerover", "Secondary Pointerover"),
|
|
||||||
new("SemiColorSecondaryActive", "Secondary Active"),
|
|
||||||
new("SemiColorSecondaryDisabled", "Secondary Disabled"),
|
|
||||||
new("SemiColorSecondaryLight", "Secondary Light"),
|
|
||||||
new("SemiColorSecondaryLightPointerover", "Secondary Light Pointerover"),
|
|
||||||
new("SemiColorSecondaryLightActive", "Secondary Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> TertiaryTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorTertiary", "Tertiary"),
|
|
||||||
new("SemiColorTertiaryPointerover", "Tertiary Pointerover"),
|
|
||||||
new("SemiColorTertiaryActive", "Tertiary Active"),
|
|
||||||
new("SemiColorTertiaryLight", "Tertiary Light"),
|
|
||||||
new("SemiColorTertiaryLightPointerover", "Tertiary Light Pointerover"),
|
|
||||||
new("SemiColorTertiaryLightActive", "Tertiary Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> InformationTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorInformation", "Information"),
|
|
||||||
new("SemiColorInformationPointerover", "Information Pointerover"),
|
|
||||||
new("SemiColorInformationActive", "Information Active"),
|
|
||||||
new("SemiColorInformationDisabled", "Information Disabled"),
|
|
||||||
new("SemiColorInformationLight", "Information Light"),
|
|
||||||
new("SemiColorInformationLightPointerover", "Information Light Pointerover"),
|
|
||||||
new("SemiColorInformationLightActive", "Information Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> SuccessTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorSuccess", "Success"),
|
|
||||||
new("SemiColorSuccessPointerover", "Success Pointerover"),
|
|
||||||
new("SemiColorSuccessActive", "Success Active"),
|
|
||||||
new("SemiColorSuccessDisabled", "Success Disabled"),
|
|
||||||
new("SemiColorSuccessLight", "Success Light"),
|
|
||||||
new("SemiColorSuccessLightPointerover", "Success Light Pointerover"),
|
|
||||||
new("SemiColorSuccessLightActive", "Success Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> WarningTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorWarning", "Warning"),
|
|
||||||
new("SemiColorWarningPointerover", "Warning Pointerover"),
|
|
||||||
new("SemiColorWarningActive", "Warning Active"),
|
|
||||||
new("SemiColorWarningLight", "Warning Light"),
|
|
||||||
new("SemiColorWarningLightPointerover", "Warning Light Pointerover"),
|
|
||||||
new("SemiColorWarningLightActive", "Warning Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> DangerTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorDanger", "Danger"),
|
|
||||||
new("SemiColorDangerPointerover", "Danger Pointerover"),
|
|
||||||
new("SemiColorDangerActive", "Danger Active"),
|
|
||||||
new("SemiColorDangerLight", "Danger Light"),
|
|
||||||
new("SemiColorDangerLightPointerover", "Danger Light Pointerover"),
|
|
||||||
new("SemiColorDangerLightActive", "Danger Light Active"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> TextTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorText0", "Text 0"),
|
|
||||||
new("SemiColorText1", "Text 1"),
|
|
||||||
new("SemiColorText2", "Text 2"),
|
|
||||||
new("SemiColorText3", "Text 3"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> LinkTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorLink", "Link"),
|
|
||||||
new("SemiColorLinkPointerover", "Link Pointerover"),
|
|
||||||
new("SemiColorLinkActive", "Link Active"),
|
|
||||||
new("SemiColorLinkVisited", "Link Visited"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> BackgroundTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorBackground0", "Background 0"),
|
|
||||||
new("SemiColorBackground1", "Background 1"),
|
|
||||||
new("SemiColorBackground2", "Background 2"),
|
|
||||||
new("SemiColorBackground3", "Background 3"),
|
|
||||||
new("SemiColorBackground4", "Background 4"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> FillTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorFill0", "Fill 0"),
|
|
||||||
new("SemiColorFill1", "Fill 1"),
|
|
||||||
new("SemiColorFill2", "Fill 2"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> BorderTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorBorder", "Border"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> DisabledTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorDisabledText", "Disabled Text"),
|
|
||||||
new("SemiColorDisabledBorder", "Disabled Border"),
|
|
||||||
new("SemiColorDisabledBackground", "Disabled Background"),
|
|
||||||
new("SemiColorDisabledFill", "Disabled Fill"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public static IReadOnlyList<Tuple<string, string>> ShadowTokens { get; } = new List<Tuple<string, string>>
|
|
||||||
{
|
|
||||||
new("SemiColorShadow", "Shadow"),
|
|
||||||
new("SemiShadowElevated", "Shadow Elevated"),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
123
demo/Semi.Avalonia.Demo/ViewModels/VariablesDemoViewModel.cs
Normal file
123
demo/Semi.Avalonia.Demo/ViewModels/VariablesDemoViewModel.cs
Normal 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}" />
|
||||||
|
""";
|
||||||
|
}
|
||||||
@@ -11,60 +11,67 @@
|
|||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
x:DataType="views:MainViewModel"
|
x:DataType="views:MainViewModel"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
<ResourceInclude Source="../Themes/TabMenu.axaml" />
|
|
||||||
<ResourceInclude Source="../Themes/ToggleButton.axaml" />
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<Grid RowDefinitions="Auto, *">
|
<Grid RowDefinitions="Auto, *">
|
||||||
<Border
|
<Border
|
||||||
|
Grid.Row="0"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
Padding="12,4"
|
Padding="12,4"
|
||||||
Theme="{DynamicResource CardBorder}">
|
Theme="{DynamicResource CardBorder}">
|
||||||
<Grid VerticalAlignment="Center" ColumnDefinitions="*, Auto">
|
<Panel>
|
||||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<TextBlock
|
<ToggleSwitch
|
||||||
|
Name="ExpandButton"
|
||||||
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
|
Content="{StaticResource SemiIconSidebar}" />
|
||||||
|
<SelectableTextBlock
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="H6"
|
Classes="H6"
|
||||||
Text="Semi Avalonia"
|
Text="Semi Avalonia"
|
||||||
Theme="{DynamicResource TitleTextBlock}" />
|
Theme="{DynamicResource TitleSelectableTextBlock}" />
|
||||||
<TextBlock
|
<SelectableTextBlock
|
||||||
Margin="8,0"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="/" />
|
Text="/" />
|
||||||
<TextBlock
|
<SelectableTextBlock
|
||||||
Margin="8,0"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Secondary"
|
Classes="Secondary"
|
||||||
Text="{ReflectionBinding #tab.SelectedItem.Header}" />
|
Text="{ReflectionBinding #tab.SelectedItem.Header}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Click="OpenDocumentation" Theme="{DynamicResource BorderlessButton}">
|
<Button
|
||||||
<PathIcon
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
Width="16"
|
Command="{Binding OpenUrlCommand}"
|
||||||
Height="16"
|
CommandParameter="{Binding DocumentationUrl}"
|
||||||
Data="M12 21.5C10.65 20.65 8.2 20 6.5 20C4.85 20 3.15 20.3 1.75 21.05C1.65 21.1 1.6 21.1 1.5 21.1C1.25 21.1 1 20.85 1 20.6V6C1.6 5.55 2.25 5.25 3 5C4.11 4.65 5.33 4.5 6.5 4.5C8.45 4.5 10.55 4.9 12 6C13.45 4.9 15.55 4.5 17.5 4.5C18.67 4.5 19.89 4.65 21 5C21.75 5.25 22.4 5.55 23 6V20.6C23 20.85 22.75 21.1 22.5 21.1C22.4 21.1 22.35 21.1 22.25 21.05C20.85 20.3 19.15 20 17.5 20C15.8 20 13.35 20.65 12 21.5M12 8V19.5C13.35 18.65 15.8 18 17.5 18C18.7 18 19.9 18.15 21 18.5V7C19.9 6.65 18.7 6.5 17.5 6.5C15.8 6.5 13.35 7.15 12 8M13 11.5C14.11 10.82 15.6 10.5 17.5 10.5C18.41 10.5 19.26 10.59 20 10.78V9.23C19.13 9.08 18.29 9 17.5 9C15.73 9 14.23 9.28 13 9.84V11.5M17.5 11.67C15.79 11.67 14.29 11.93 13 12.46V14.15C14.11 13.5 15.6 13.16 17.5 13.16C18.54 13.16 19.38 13.24 20 13.4V11.9C19.13 11.74 18.29 11.67 17.5 11.67M20 14.57C19.13 14.41 18.29 14.33 17.5 14.33C15.67 14.33 14.17 14.6 13 15.13V16.82C14.11 16.16 15.6 15.83 17.5 15.83C18.54 15.83 19.38 15.91 20 16.07V14.57Z"
|
Content="{StaticResource SemiIconGlobe}" />
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
|
||||||
</Button>
|
|
||||||
<Button Click="OpenRepository" Theme="{DynamicResource BorderlessButton}">
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"
|
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
|
||||||
</Button>
|
|
||||||
<ComboBox
|
|
||||||
MinWidth="100"
|
|
||||||
PlaceholderText="Select a theme"
|
|
||||||
DisplayMemberBinding="{Binding Name}"
|
|
||||||
ItemsSource="{Binding Themes}"
|
|
||||||
SelectedItem="{Binding SelectedTheme}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Command="{Binding OpenUrlCommand}"
|
||||||
|
CommandParameter="{Binding RepoUrl}"
|
||||||
|
Content="{StaticResource SemiIconGithubLogo}" />
|
||||||
|
|
||||||
|
<ToggleSwitch
|
||||||
|
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||||
|
Command="{Binding ToggleThemeCommand}"
|
||||||
|
OnContent="{StaticResource SemiIconMoon}"
|
||||||
|
OffContent="{StaticResource SemiIconSun}" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Theme="{DynamicResource IconBorderlessButton}"
|
||||||
|
Content="{StaticResource SemiIconMenu}">
|
||||||
|
<Button.Flyout>
|
||||||
|
<MenuFlyout Placement="Bottom" ItemsSource="{Binding MenuItems}" />
|
||||||
|
</Button.Flyout>
|
||||||
|
<Button.Styles>
|
||||||
|
<Style Selector="MenuItem" x:DataType="views:MenuItemViewModel">
|
||||||
|
<Setter Property="Header" Value="{Binding Header}" />
|
||||||
|
<Setter Property="ItemsSource" Value="{Binding Items}" />
|
||||||
|
<Setter Property="Command" Value="{Binding Command}" />
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
||||||
|
</Style>
|
||||||
|
</Button.Styles>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Panel>
|
||||||
</Border>
|
</Border>
|
||||||
<TabControl
|
<TabControl
|
||||||
Name="tab"
|
Name="tab"
|
||||||
@@ -73,6 +80,7 @@
|
|||||||
Padding="20,0,0,0"
|
Padding="20,0,0,0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
TabStripPlacement="Left"
|
TabStripPlacement="Left"
|
||||||
|
Classes.Dismiss="{Binding #ExpandButton.IsChecked}"
|
||||||
Theme="{DynamicResource NavigationTab}">
|
Theme="{DynamicResource NavigationTab}">
|
||||||
<TabItem Header="Overview">
|
<TabItem Header="Overview">
|
||||||
<pages:Overview />
|
<pages:Overview />
|
||||||
@@ -80,6 +88,15 @@
|
|||||||
<TabItem Header="Palette">
|
<TabItem Header="Palette">
|
||||||
<pages:PaletteDemo />
|
<pages:PaletteDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="HighContrastTheme">
|
||||||
|
<pages:HighContrastDemo />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Variables">
|
||||||
|
<pages:VariablesDemo />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Icon">
|
||||||
|
<pages:IconDemo />
|
||||||
|
</TabItem>
|
||||||
<TabItem Header="AutoCompleteBox">
|
<TabItem Header="AutoCompleteBox">
|
||||||
<pages:AutoCompleteBoxDemo />
|
<pages:AutoCompleteBoxDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -126,7 +143,7 @@
|
|||||||
<pages:FlyoutDemo />
|
<pages:FlyoutDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="GridSplitter">
|
<TabItem Header="GridSplitter">
|
||||||
<pages:GridSplitter />
|
<pages:GridSplitterDemo />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="HeaderedContentControl">
|
<TabItem Header="HeaderedContentControl">
|
||||||
<pages:HeaderedContentControlDemo />
|
<pages:HeaderedContentControlDemo />
|
||||||
@@ -209,4 +226,4 @@
|
|||||||
</TabControl>
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Views;
|
namespace Semi.Avalonia.Demo.Views;
|
||||||
|
|
||||||
@@ -15,62 +19,164 @@ public partial class MainView : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new MainViewModel();
|
this.DataContext = new MainViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleButton_OnIsCheckedChanged(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var app = Application.Current;
|
|
||||||
if (app is not null)
|
|
||||||
{
|
|
||||||
var theme = app.ActualThemeVariant;
|
|
||||||
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OpenRepository(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var top = TopLevel.GetTopLevel(this);
|
|
||||||
if (top is null) return;
|
|
||||||
var launcher = top.Launcher;
|
|
||||||
await launcher.LaunchUriAsync(new Uri("https://github.com/irihitech/Semi.Avalonia"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OpenDocumentation(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var top = TopLevel.GetTopLevel(this);
|
|
||||||
if (top is null) return;
|
|
||||||
var launcher = top.Launcher;
|
|
||||||
await launcher.LaunchUriAsync(new Uri("https://docs.irihi.tech/semi"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class MainViewModel : ObservableObject
|
public partial class MainViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
public ObservableCollection<ThemeItem> Themes { get; } =
|
public string DocumentationUrl => "https://docs.irihi.tech/semi";
|
||||||
[
|
public string RepoUrl => "https://github.com/irihitech/Semi.Avalonia";
|
||||||
new("Default", ThemeVariant.Default),
|
public IReadOnlyList<MenuItemViewModel> MenuItems { get; }
|
||||||
new("Light", ThemeVariant.Light),
|
|
||||||
new("Dark", ThemeVariant.Dark),
|
|
||||||
new("Aquatic", SemiTheme.Aquatic),
|
|
||||||
new("Desert", SemiTheme.Desert),
|
|
||||||
new("Dust", SemiTheme.Dust),
|
|
||||||
new("NightSky", SemiTheme.NightSky)
|
|
||||||
];
|
|
||||||
|
|
||||||
[ObservableProperty] private ThemeItem? _selectedTheme;
|
public MainViewModel()
|
||||||
|
{
|
||||||
partial void OnSelectedThemeChanged(ThemeItem? oldValue, ThemeItem? newValue)
|
MenuItems =
|
||||||
|
[
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Theme",
|
||||||
|
Items =
|
||||||
|
[
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Auto",
|
||||||
|
Command = FollowSystemThemeCommand
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Aquatic",
|
||||||
|
Command = SelectThemeCommand,
|
||||||
|
CommandParameter = SemiTheme.Aquatic
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Desert",
|
||||||
|
Command = SelectThemeCommand,
|
||||||
|
CommandParameter = SemiTheme.Desert
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Dusk",
|
||||||
|
Command = SelectThemeCommand,
|
||||||
|
CommandParameter = SemiTheme.Dusk
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "NightSky",
|
||||||
|
Command = SelectThemeCommand,
|
||||||
|
CommandParameter = SemiTheme.NightSky
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Locale",
|
||||||
|
Items =
|
||||||
|
[
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "简体中文",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("zh-cn")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "English",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("en-us")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "日本語",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("ja-jp")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Українська",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("uk-ua")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Русский",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("ru-ru")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "繁體中文",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("zh-tw")
|
||||||
|
},
|
||||||
|
new MenuItemViewModel
|
||||||
|
{
|
||||||
|
Header = "Deutsch",
|
||||||
|
Command = SelectLocaleCommand,
|
||||||
|
CommandParameter = new CultureInfo("de-de")
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void FollowSystemTheme()
|
||||||
|
{
|
||||||
|
Application.Current?.RegisterFollowSystemTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void ToggleTheme()
|
||||||
{
|
{
|
||||||
if (newValue is null) return;
|
|
||||||
var app = Application.Current;
|
var app = Application.Current;
|
||||||
if (app is not null)
|
if (app is null) return;
|
||||||
|
var theme = app.ActualThemeVariant;
|
||||||
|
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
||||||
|
app.UnregisterFollowSystemTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void SelectTheme(object? obj)
|
||||||
|
{
|
||||||
|
var app = Application.Current;
|
||||||
|
if (app is null) return;
|
||||||
|
app.RequestedThemeVariant = obj as ThemeVariant;
|
||||||
|
app.UnregisterFollowSystemTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void SelectLocale(object? obj)
|
||||||
|
{
|
||||||
|
var app = Application.Current;
|
||||||
|
if (app is null) return;
|
||||||
|
SemiTheme.OverrideLocaleResources(app, obj as CultureInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private static async Task OpenUrl(string url)
|
||||||
|
{
|
||||||
|
var launcher = ResolveDefaultTopLevel()?.Launcher;
|
||||||
|
if (launcher is not null)
|
||||||
{
|
{
|
||||||
app.RequestedThemeVariant = newValue.Theme;
|
await launcher.LaunchUriAsync(new Uri(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TopLevel? ResolveDefaultTopLevel()
|
||||||
|
{
|
||||||
|
return Application.Current?.ApplicationLifetime switch
|
||||||
|
{
|
||||||
|
IClassicDesktopStyleApplicationLifetime desktopLifetime => desktopLifetime.MainWindow,
|
||||||
|
ISingleViewApplicationLifetime singleView => TopLevel.GetTopLevel(singleView.MainView),
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThemeItem(string name, ThemeVariant theme)
|
public class MenuItemViewModel
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = name;
|
public string? Header { get; set; }
|
||||||
public ThemeVariant Theme { get; set; } = theme;
|
public ICommand? Command { get; set; }
|
||||||
|
public object? CommandParameter { get; set; }
|
||||||
|
public IList<MenuItemViewModel>? Items { get; set; }
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
Title="Semi.Avalonia.Demo"
|
Title="Semi.Avalonia.Demo"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
Icon="/Assets/avalonia-logo.ico"
|
Icon="/Assets/irihi.ico"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<views:MainView />
|
<views:MainView />
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
x:Class="Semi.Avalonia.TreeDataGrid.Demo.App"
|
x:Class="Semi.Avalonia.TreeDataGrid.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"
|
||||||
RequestedThemeVariant="Default">
|
xmlns:semi="https://irihi.tech/semi">
|
||||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
|
<semi:SemiTheme Locale="zh-CN" />
|
||||||
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
|
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using Avalonia;
|
using System;
|
||||||
using System;
|
using Avalonia;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace Semi.Avalonia.TreeDataGrid.Demo;
|
namespace Semi.Avalonia.TreeDataGrid.Demo;
|
||||||
|
|
||||||
class Program
|
sealed class Program
|
||||||
{
|
{
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
|||||||
@@ -12,18 +12,21 @@
|
|||||||
<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->
|
<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="../Directory.Build.props" />
|
<Import Project="../Directory.Build.props"/>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
|
||||||
<!--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 Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)">
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)" />
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj" />
|
<ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>
|
||||||
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj" />
|
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<TargetFrameworks>net6.0;net8.0;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net8.0;netstandard2.0</TargetFrameworks>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Version>11.2.1</Version>
|
<Version>11.2.1.4</Version>
|
||||||
<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>
|
||||||
|
|||||||
@@ -76,7 +76,6 @@
|
|||||||
Width="300"
|
Width="300"
|
||||||
Height="300"
|
Height="300"
|
||||||
RowDefinitions="*,Auto">
|
RowDefinitions="*,Auto">
|
||||||
<Grid.Styles />
|
|
||||||
<!-- Backgrounds -->
|
<!-- Backgrounds -->
|
||||||
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
|
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
|
||||||
<Border
|
<Border
|
||||||
@@ -143,7 +142,7 @@
|
|||||||
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
||||||
Orientation="Vertical" />
|
Orientation="Vertical" />
|
||||||
<primitives:ColorSpectrum
|
<primitives:ColorSpectrum
|
||||||
Name="ColorSpectrum"
|
x:Name="ColorSpectrum"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -334,7 +333,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component1Slider}" />
|
Value="{Binding Value, ElementName=Component1Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component1Slider"
|
x:Name="Component1Slider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -365,7 +364,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component2Slider}" />
|
Value="{Binding Value, ElementName=Component2Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component2Slider"
|
x:Name="Component2Slider"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -396,7 +395,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component3Slider}" />
|
Value="{Binding Value, ElementName=Component3Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component3Slider"
|
x:Name="Component3Slider"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -434,7 +433,7 @@
|
|||||||
</NumericUpDown.IsVisible>
|
</NumericUpDown.IsVisible>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="AlphaComponentSlider"
|
x:Name="AlphaComponentSlider"
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -559,7 +558,7 @@
|
|||||||
CornerRadius="8 8 0 0"
|
CornerRadius="8 8 0 0"
|
||||||
ClipToBounds="True">
|
ClipToBounds="True">
|
||||||
<primitives:ColorSpectrum
|
<primitives:ColorSpectrum
|
||||||
Name="ColorSpectrum"
|
x:Name="ColorSpectrum"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
@@ -585,7 +584,7 @@
|
|||||||
Orientation="Horizontal" />
|
Orientation="Horizontal" />
|
||||||
|
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="ColorSpectrumAlphaSlider"
|
x:Name="ColorSpectrumAlphaSlider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|||||||
@@ -237,7 +237,7 @@
|
|||||||
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
||||||
Orientation="Vertical" />
|
Orientation="Vertical" />
|
||||||
<primitives:ColorSpectrum
|
<primitives:ColorSpectrum
|
||||||
Name="ColorSpectrum"
|
x:Name="ColorSpectrum"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
MinValue="{TemplateBinding MinValue}"
|
MinValue="{TemplateBinding MinValue}"
|
||||||
Shape="{TemplateBinding ColorSpectrumShape}" />
|
Shape="{TemplateBinding ColorSpectrumShape}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="ColorSpectrumAlphaSlider"
|
x:Name="ColorSpectrumAlphaSlider"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="12,0,0,0"
|
Margin="12,0,0,0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
CornerRadius="3">
|
CornerRadius="3">
|
||||||
<Grid ColumnDefinitions="1*,1*" IsVisible="{TemplateBinding IsColorModelVisible}">
|
<Grid ColumnDefinitions="1*,1*" IsVisible="{TemplateBinding IsColorModelVisible}">
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Name="RgbRadioButton"
|
x:Name="RgbRadioButton"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
HorizontalContentAlignment="Center"
|
HorizontalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
@@ -359,7 +359,7 @@
|
|||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
Theme="{DynamicResource ColorViewRadioButton}" />
|
Theme="{DynamicResource ColorViewRadioButton}" />
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Name="HsvRadioButton"
|
x:Name="HsvRadioButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalContentAlignment="Center"
|
HorizontalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
@@ -373,7 +373,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_HexTextBox"
|
x:Name="PART_HexTextBox"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Height="32"
|
Height="32"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -400,7 +400,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component1Slider}" />
|
Value="{Binding Value, ElementName=Component1Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component1Slider"
|
x:Name="Component1Slider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -431,7 +431,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component2Slider}" />
|
Value="{Binding Value, ElementName=Component2Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component2Slider"
|
x:Name="Component2Slider"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -462,7 +462,7 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component3Slider}" />
|
Value="{Binding Value, ElementName=Component3Slider}" />
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="Component3Slider"
|
x:Name="Component3Slider"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -500,7 +500,7 @@
|
|||||||
</NumericUpDown.IsVisible>
|
</NumericUpDown.IsVisible>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="AlphaComponentSlider"
|
x:Name="AlphaComponentSlider"
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -584,7 +584,7 @@
|
|||||||
CornerRadius="8 8 0 0"
|
CornerRadius="8 8 0 0"
|
||||||
ClipToBounds="True">
|
ClipToBounds="True">
|
||||||
<primitives:ColorSpectrum
|
<primitives:ColorSpectrum
|
||||||
Name="ColorSpectrum"
|
x:Name="ColorSpectrum"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
@@ -610,7 +610,7 @@
|
|||||||
Orientation="Horizontal" />
|
Orientation="Horizontal" />
|
||||||
|
|
||||||
<primitives:ColorSlider
|
<primitives:ColorSlider
|
||||||
Name="ColorSpectrumAlphaSlider"
|
x:Name="ColorSpectrumAlphaSlider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Title>Semi.Avalonia.ColorPicker</Title>
|
<Title>Semi.Avalonia.ColorPicker</Title>
|
||||||
<PackageReleaseNotes>Update to Avalonia 11.2.1</PackageReleaseNotes>
|
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.2.1.4</PackageReleaseNotes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
|
||||||
|
|||||||
@@ -6,15 +6,12 @@
|
|||||||
<Thickness x:Key="ColorViewRadioButtonPadding">16 4</Thickness>
|
<Thickness x:Key="ColorViewRadioButtonPadding">16 4</Thickness>
|
||||||
<x:Double x:Key="ColorViewNumericUpDownWidth">70</x:Double>
|
<x:Double x:Key="ColorViewNumericUpDownWidth">70</x:Double>
|
||||||
|
|
||||||
<StreamGeometry x:Key="ColorViewSpectrumIconGlyph">
|
<StreamGeometry x:Key="ColorViewSpectrumIconGlyph">M1.22 20.77a4.24 4.24 0 0 1 .02-5.98l9.33-9.28-.94-.95a1.41 1.41 0 0 1 0-1.99 1.39 1.39 0 0 1 1.97 0l.95.97L14.9 1.2a4.16 4.16 0 0 1 5.89.02 4.24 4.24 0 0 1-.02 5.98l-2.3 2.28 1.02 1.02c.54.55.54 1.44 0 1.99-.55.55-1.43.55-1.97 0l-1.03-1.03-9.37 9.32a4.16 4.16 0 0 1-5.89-.02ZM12.54 7.49l1.97 1.99-9.35 9.3c-.55.55-1.42.55-1.97 0a1.41 1.41 0 0 1 .01-2l9.34-9.29Z</StreamGeometry>
|
||||||
M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z
|
<StreamGeometry x:Key="ColorViewPaletteIconGlyph">M2 4c0-1.1.9-2 2-2h5a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm6 13.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm11.59-8.91L16.4 5.4a2 2 0 0 0-2.82 0L13 6v12l6.59-6.59a2 2 0 0 0 0-2.82ZM22 16a2 2 0 0 0-2-2l-8 8h8a2 2 0 0 0 2-2v-4Z</StreamGeometry>
|
||||||
</StreamGeometry>
|
<StreamGeometry x:Key="ColorViewComponentsIconGlyph">M4 6.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM9.5 3a1.5 1.5 0 1 0 0 3h11a1.5 1.5 0 0 0 0-3h-11ZM8 11.5c0-.83.67-1.5 1.5-1.5h11a1.5 1.5 0 0 1 0 3h-11A1.5 1.5 0 0 1 8 11.5Zm0 7c0-.83.67-1.5 1.5-1.5h11a1.5 1.5 0 0 1 0 3h-11A1.5 1.5 0 0 1 8 18.5Zm-2-7a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-2 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="ColorViewPaletteIconGlyph">
|
<!-- <StaticResource x:Key="ColorViewSpectrumIconGlyph" ResourceKey="SemiIconEyedropper" /> -->
|
||||||
M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z
|
<!-- <StaticResource x:Key="ColorViewPaletteIconGlyph" ResourceKey="SemiIconColorPalette" /> -->
|
||||||
</StreamGeometry>
|
<!-- <StaticResource x:Key="ColorViewComponentsIconGlyph" ResourceKey="SemiIconList" /> -->
|
||||||
<StreamGeometry x:Key="ColorViewComponentsIconGlyph">
|
|
||||||
M4 6.5C5.10457 6.5 6 5.60457 6 4.5C6 3.39543 5.10457 2.5 4 2.5C2.89543 2.5 2 3.39543 2 4.5C2 5.60457 2.89543 6.5 4 6.5ZM9.5 3C8.67157 3 8 3.67157 8 4.5C8 5.32843 8.67157 6 9.5 6H20.5C21.3284 6 22 5.32843 22 4.5C22 3.67157 21.3284 3 20.5 3H9.5ZM8 11.5C8 10.6716 8.67157 10 9.5 10H20.5C21.3284 10 22 10.6716 22 11.5C22 12.3284 21.3284 13 20.5 13H9.5C8.67157 13 8 12.3284 8 11.5ZM8 18.5C8 17.6716 8.67157 17 9.5 17H20.5C21.3284 17 22 17.6716 22 18.5C22 19.3284 21.3284 20 20.5 20H9.5C8.67157 20 8 19.3284 8 18.5ZM6 11.5C6 12.6046 5.10457 13.5 4 13.5C2.89543 13.5 2 12.6046 2 11.5C2 10.3954 2.89543 9.5 4 9.5C5.10457 9.5 6 10.3954 6 11.5ZM4 20.5C5.10457 20.5 6 19.6046 6 18.5C6 17.3954 5.10457 16.5 4 16.5C2.89543 16.5 2 17.3954 2 18.5C2 19.6046 2.89543 20.5 4 20.5Z
|
|
||||||
</StreamGeometry>
|
|
||||||
|
|
||||||
<x:Double x:Key="ColorSliderWidth">16</x:Double>
|
<x:Double x:Key="ColorSliderWidth">16</x:Double>
|
||||||
<CornerRadius x:Key="ColorSliderCornerRadius">6</CornerRadius>
|
<CornerRadius x:Key="ColorSliderCornerRadius">6</CornerRadius>
|
||||||
@@ -27,7 +24,7 @@
|
|||||||
<CornerRadius x:Key="ColorPreviewerCornerRadius">3</CornerRadius>
|
<CornerRadius x:Key="ColorPreviewerCornerRadius">3</CornerRadius>
|
||||||
|
|
||||||
<colorPicker:SemiColorDarkPalette x:Key="SemiColorPalette" />
|
<colorPicker:SemiColorDarkPalette x:Key="SemiColorPalette" />
|
||||||
|
|
||||||
<PlacementMode x:Key="ColorPickerFlyoutPlacement">AnchorAndGravity</PlacementMode>
|
<PlacementMode x:Key="ColorPickerFlyoutPlacement">AnchorAndGravity</PlacementMode>
|
||||||
<PlacementMode x:Key="SimpleColorPickerFlyoutPlacement">BottomEdgeAlignedLeft</PlacementMode>
|
<PlacementMode x:Key="SimpleColorPickerFlyoutPlacement">BottomEdgeAlignedLeft</PlacementMode>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<Import Project="../Package.props"/>
|
<Import Project="../Package.props"/>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Title>Semi.Avalonia.DataGrid</Title>
|
<Title>Semi.Avalonia.DataGrid</Title>
|
||||||
<PackageReleaseNotes>Update to Avalonia 11.2.1</PackageReleaseNotes>
|
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.2.1.4</PackageReleaseNotes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
|
||||||
|
|||||||
@@ -8,13 +8,16 @@
|
|||||||
<Thickness x:Key="DataGridColumnHeaderPadding">12 0 0 0</Thickness>
|
<Thickness x:Key="DataGridColumnHeaderPadding">12 0 0 0</Thickness>
|
||||||
<x:Double x:Key="DataGridColumnHeaderMinHeight">32</x:Double>
|
<x:Double x:Key="DataGridColumnHeaderMinHeight">32</x:Double>
|
||||||
|
|
||||||
<StreamGeometry x:Key="DataGridColumnHeaderAscendingGlyph">M6.45096 8.34102L11.247 2.86102C11.3408 2.75361 11.4566 2.66753 11.5865 2.60854C11.7163 2.54956 11.8573 2.51904 12 2.51904C12.1426 2.51904 12.2836 2.54956 12.4135 2.60854C12.5433 2.66753 12.6591 2.75361 12.753 2.86102L17.549 8.34102C18.115 8.98802 17.655 10 16.796 10H7.20396C6.34396 10 5.88496 8.98802 6.45096 8.34102Z</StreamGeometry>
|
<StreamGeometry x:Key="DataGridColumnHeaderAscendingGlyph">m6.45 8.34 4.8-5.48a1 1 0 0 1 1.5 0l4.8 5.48A1 1 0 0 1 16.8 10H7.2a1 1 0 0 1-.75-1.66Z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="DataGridColumnHeaderDescendingGlyph">M17.549 15.659L12.753 21.139C12.6591 21.2464 12.5434 21.3325 12.4135 21.3915C12.2836 21.4505 12.1427 21.481 12 21.481C11.8574 21.481 11.7164 21.4505 11.5865 21.3915C11.4566 21.3325 11.3409 21.2464 11.247 21.139L6.45101 15.659C5.88501 15.011 6.34501 14 7.20401 14H16.796C17.656 14 18.115 15.012 17.549 15.659Z</StreamGeometry>
|
<StreamGeometry x:Key="DataGridColumnHeaderDescendingGlyph">m17.55 15.66-4.8 5.48a1 1 0 0 1-1.5 0l-4.8-5.48A1 1 0 0 1 7.2 14h9.6a1 1 0 0 1 .75 1.66Z</StreamGeometry>
|
||||||
|
<!-- <StaticResource x:Key="DataGridColumnHeaderAscendingGlyph" ResourceKey="SemiIconCaretUp" /> -->
|
||||||
|
<!-- <StaticResource x:Key="DataGridColumnHeaderDescendingGlyph" ResourceKey="SemiIconCaretDown" /> -->
|
||||||
|
|
||||||
<Thickness x:Key="DataGridRowHeaderMargin">8 0</Thickness>
|
<Thickness x:Key="DataGridRowHeaderMargin">8 0</Thickness>
|
||||||
<Thickness x:Key="DataGridRowMargin">2</Thickness>
|
<Thickness x:Key="DataGridRowMargin">2</Thickness>
|
||||||
|
|
||||||
<StreamGeometry x:Key="DataGridRowGroupHeaderExpandIconGlyph">M7.43934 19.7957C6.85355 19.2099 6.85355 18.2601 7.43934 17.6744L13.0962 12.0175L7.43934 6.36065C6.85355 5.77486 6.85355 4.82511 7.43934 4.23933C8.02513 3.65354 8.97487 3.65354 9.56066 4.23933L16.2782 10.9568C16.864 11.5426 16.864 12.4924 16.2782 13.0782L9.56066 19.7957C8.97487 20.3815 8.02513 20.3815 7.43934 19.7957Z</StreamGeometry>
|
<StreamGeometry x:Key="DataGridRowGroupHeaderExpandIconGlyph">M7.44 19.8a1.5 1.5 0 0 1 0-2.13l5.66-5.65-5.66-5.66a1.5 1.5 0 1 1 2.12-2.12l6.72 6.72a1.5 1.5 0 0 1 0 2.12L9.56 19.8a1.5 1.5 0 0 1-2.12 0Z</StreamGeometry>
|
||||||
|
<!-- <StaticResource x:Key="DataGridRowGroupHeaderExpandIconGlyph" ResourceKey="SemiIconChevronRight" /> -->
|
||||||
|
|
||||||
<x:Double x:Key="DataGridRowGroupHeaderVisualStrokeThickness">1</x:Double>
|
<x:Double x:Key="DataGridRowGroupHeaderVisualStrokeThickness">1</x:Double>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<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">
|
||||||
<StreamGeometry x:Key="TreeDataGridSortIconDescendingPath">
|
<StreamGeometry x:Key="TreeDataGridSortIconAscendingPath">m6.45 8.34 4.8-5.48a1 1 0 0 1 1.5 0l4.8 5.48A1 1 0 0 1 16.8 10H7.2a1 1 0 0 1-.75-1.66Z</StreamGeometry>
|
||||||
M17.549 15.659L12.753 21.139C12.6591 21.2464 12.5434 21.3325 12.4135 21.3915C12.2836 21.4505 12.1427 21.481 12 21.481C11.8574 21.481 11.7164 21.4505 11.5865 21.3915C11.4566 21.3325 11.3409 21.2464 11.247 21.139L6.45101 15.659C5.88501 15.011 6.34501 14 7.20401 14H16.796C17.656 14 18.115 15.012 17.549 15.659Z
|
<StreamGeometry x:Key="TreeDataGridSortIconDescendingPath">m17.55 15.66-4.8 5.48a1 1 0 0 1-1.5 0l-4.8-5.48A1 1 0 0 1 7.2 14h9.6a1 1 0 0 1 .75 1.66Z</StreamGeometry>
|
||||||
</StreamGeometry>
|
<StreamGeometry x:Key="TreeDataGridItemCollapsedChevronPathData">m9.66 3.44 8.97 7.8a1 1 0 0 1 0 1.51l-8.97 7.81A1 1 0 0 1 8 19.81V4.19a1 1 0 0 1 1.66-.75Z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="TreeDataGridSortIconAscendingPath">M6.45096 8.34102L11.247 2.86102C11.3408 2.75361 11.4566 2.66753 11.5865 2.60854C11.7163 2.54956 11.8573 2.51904 12 2.51904C12.1426 2.51904 12.2836 2.54956 12.4135 2.60854C12.5433 2.66753 12.6591 2.75361 12.753 2.86102L17.549 8.34102C18.115 8.98802 17.655 10 16.796 10H7.20396C6.34396 10 5.88496 8.98802 6.45096 8.34102Z</StreamGeometry>
|
<!-- <StaticResource x:Key="TreeDataGridSortIconAscendingPath" ResourceKey="SemiIconCaretUp"/> -->
|
||||||
<StreamGeometry x:Key="TreeDataGridItemCollapsedChevronPathData">M9.65618 3.44015L18.6322 11.2454C19.0906 11.644 19.0906 12.356 18.6322 12.7546L9.65618 20.5598C9.00895 21.1226 8 20.6629 8 19.8052V4.19475C8 3.33705 9.00895 2.87734 9.65618 3.44015Z</StreamGeometry>
|
<!-- <StaticResource x:Key="TreeDataGridSortIconDescendingPath" ResourceKey="SemiIconCaretDown"/> -->
|
||||||
|
<!-- <StaticResource x:Key="TreeDataGridItemCollapsedChevronPathData" ResourceKey="SemiIconTreeTriangleRight"/> -->
|
||||||
<Thickness x:Key="TreeDataGridRowMargin">2</Thickness>
|
<Thickness x:Key="TreeDataGridRowMargin">2</Thickness>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
37
src/Semi.Avalonia/Animations/SemiPopupAnimations.axaml
Normal file
37
src/Semi.Avalonia/Animations/SemiPopupAnimations.axaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<Styles xmlns="https://github.com/avaloniaui"
|
||||||
|
x:Class="Semi.Avalonia.SemiPopupAnimations"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
|
||||||
|
<Style Selector="Popup LayoutTransformControl#PART_LayoutTransform">
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={x:Static converters:PlacementToRenderTransformOriginConverter.Instance}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform">
|
||||||
|
<Style.Animations>
|
||||||
|
<Animation Duration="0:0:0.1" FillMode="Forward" Easing="CubicEaseIn">
|
||||||
|
<KeyFrame Cue="0.0">
|
||||||
|
<Setter Property="ScaleTransform.ScaleX" Value="0.98" />
|
||||||
|
<Setter Property="ScaleTransform.ScaleY" Value="0.98" />
|
||||||
|
</KeyFrame>
|
||||||
|
<KeyFrame Cue="1.0">
|
||||||
|
<Setter Property="ScaleTransform.ScaleX" Value="1.0" />
|
||||||
|
<Setter Property="ScaleTransform.ScaleY" Value="1.0" />
|
||||||
|
</KeyFrame>
|
||||||
|
</Animation>
|
||||||
|
</Style.Animations>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Popup[IsOpen=False] LayoutTransformControl#PART_LayoutTransform">
|
||||||
|
<Style.Animations>
|
||||||
|
<Animation Duration="0:0:0.1" FillMode="Forward" Easing="CubicEaseOut">
|
||||||
|
<KeyFrame Cue="0.0">
|
||||||
|
<Setter Property="ScaleTransform.ScaleX" Value="1.0" />
|
||||||
|
<Setter Property="ScaleTransform.ScaleY" Value="1.0" />
|
||||||
|
</KeyFrame>
|
||||||
|
<KeyFrame Cue="1.0">
|
||||||
|
<Setter Property="ScaleTransform.ScaleX" Value="0.98" />
|
||||||
|
<Setter Property="ScaleTransform.ScaleY" Value="0.98" />
|
||||||
|
</KeyFrame>
|
||||||
|
</Animation>
|
||||||
|
</Style.Animations>
|
||||||
|
</Style>
|
||||||
|
</Styles>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Styling;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia;
|
||||||
|
|
||||||
|
public class SemiPopupAnimations: Styles
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,28 +27,25 @@
|
|||||||
Watermark="{TemplateBinding Watermark}" />
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
<Popup
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}">
|
PlacementTarget="{TemplateBinding}">
|
||||||
<Border
|
<Border
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||||
|
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||||
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
||||||
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
||||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
||||||
<Border
|
<ListBox
|
||||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}"
|
Name="PART_SelectingItemsControl"
|
||||||
ClipToBounds="True">
|
Foreground="{TemplateBinding Foreground}"
|
||||||
<ListBox
|
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||||
Name="PART_SelectingItemsControl"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Panel>
|
</Panel>
|
||||||
@@ -69,28 +66,25 @@
|
|||||||
Watermark="{TemplateBinding Watermark}" />
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
<Popup
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}">
|
PlacementTarget="{TemplateBinding}">
|
||||||
<Border
|
<Border
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||||
|
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||||
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
||||||
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
||||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
||||||
<Border
|
|
||||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}"
|
|
||||||
ClipToBounds="True">
|
|
||||||
<ListBox
|
<ListBox
|
||||||
Name="PART_SelectingItemsControl"
|
Name="PART_SelectingItemsControl"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|||||||
@@ -272,18 +272,20 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="InnerIconButton" TargetType="Button">
|
<ControlTheme x:Key="InnerIconButton" TargetType="Button">
|
||||||
|
<Setter Property="Width" Value="16"/>
|
||||||
|
<Setter Property="Height" Value="16"/>
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<ContentControl Background="Transparent">
|
<PathIcon
|
||||||
<PathIcon
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="16"
|
Width="{TemplateBinding Width}"
|
||||||
Height="16"
|
Height="{TemplateBinding Height}"
|
||||||
Margin="{TemplateBinding Padding}"
|
Data="{TemplateBinding Content}"
|
||||||
Data="{TemplateBinding Content}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Foreground="{TemplateBinding Foreground}" />
|
Background="{TemplateBinding Background}" />
|
||||||
</ContentControl>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover">
|
<Style Selector="^:pointerover">
|
||||||
|
|||||||
@@ -73,8 +73,8 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Theme="{StaticResource ButtonSpinnerRepeatButton}">
|
Theme="{StaticResource ButtonSpinnerRepeatButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="8"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="8"
|
Classes="ExtraSmall"
|
||||||
Data="{DynamicResource ButtonSpinnerIncreaseButtonGlyph}"
|
Data="{DynamicResource ButtonSpinnerIncreaseButtonGlyph}"
|
||||||
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
|
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
|
||||||
</RepeatButton>
|
</RepeatButton>
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Theme="{StaticResource ButtonSpinnerRepeatButton}">
|
Theme="{StaticResource ButtonSpinnerRepeatButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="8"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="8"
|
Classes="ExtraSmall"
|
||||||
Data="{DynamicResource ButtonSpinnerDecreaseButtonGlyph}"
|
Data="{DynamicResource ButtonSpinnerDecreaseButtonGlyph}"
|
||||||
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
|
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
|
||||||
</RepeatButton>
|
</RepeatButton>
|
||||||
|
|||||||
@@ -65,8 +65,8 @@
|
|||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource BorderlessButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="12"
|
Classes="Large"
|
||||||
Data="{DynamicResource CalendarItemPreviousIconGlyph}"
|
Data="{DynamicResource CalendarItemPreviousIconGlyph}"
|
||||||
Foreground="{DynamicResource CalendarItemIconForeground}" />
|
Foreground="{DynamicResource CalendarItemIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -85,8 +85,8 @@
|
|||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource BorderlessButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="12"
|
Classes="Large"
|
||||||
Data="{DynamicResource CalendarItemNextIconGlyph}"
|
Data="{DynamicResource CalendarItemNextIconGlyph}"
|
||||||
Foreground="{DynamicResource CalendarItemIconForeground}" />
|
Foreground="{DynamicResource CalendarItemIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -95,7 +95,8 @@
|
|||||||
Name="PART_MonthView"
|
Name="PART_MonthView"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsVisible="False">
|
IsVisible="False"
|
||||||
|
ColumnDefinitions="*,*,*,*,*,*,*">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="{DynamicResource CalendarItemWeekDayNameHeight}" />
|
<RowDefinition Height="{DynamicResource CalendarItemWeekDayNameHeight}" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
@@ -105,33 +106,14 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
Name="PART_YearView"
|
Name="PART_YearView"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
IsVisible="False">
|
IsVisible="False"
|
||||||
<Grid.RowDefinitions>
|
ColumnDefinitions="*,*,*,*"
|
||||||
<RowDefinition Height="*" />
|
RowDefinitions="*,*,*" />
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@@ -151,6 +133,7 @@
|
|||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="CalendarButton">
|
<ControlTemplate TargetType="CalendarButton">
|
||||||
<ContentControl
|
<ContentControl
|
||||||
@@ -211,6 +194,7 @@
|
|||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="CalendarDayButton">
|
<ControlTemplate TargetType="CalendarDayButton">
|
||||||
<ContentControl
|
<ContentControl
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
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:CompileBindings="True">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Margin="20" Width="800" Height="400">
|
||||||
|
<CalendarDatePicker HorizontalAlignment="Center" Classes="ClearButton" />
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
|
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
|
||||||
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
|
||||||
@@ -75,41 +80,38 @@
|
|||||||
<Button
|
<Button
|
||||||
Name="ClearButton"
|
Name="ClearButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Padding="0,0,8,0"
|
Theme="{DynamicResource InnerIconButton}"
|
||||||
|
Margin="8 0"
|
||||||
Content="{DynamicResource IconButtonClearData}"
|
Content="{DynamicResource IconButtonClearData}"
|
||||||
Command="{Binding $parent[CalendarDatePicker].Clear}"
|
Command="{Binding $parent[CalendarDatePicker].Clear}"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
IsVisible="False"
|
IsVisible="False" />
|
||||||
Theme="{DynamicResource InnerIconButton}" />
|
|
||||||
<Button
|
<Button
|
||||||
Name="PART_Button"
|
Name="PART_Button"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Padding="0,0,8,0"
|
Theme="{DynamicResource InnerIconButton}"
|
||||||
|
Margin="8 0"
|
||||||
Content="{DynamicResource CalendarDatePickerIconGlyph}"
|
Content="{DynamicResource CalendarDatePickerIconGlyph}"
|
||||||
Focusable="False"
|
Focusable="False" />
|
||||||
Theme="{DynamicResource InnerIconButton}" />
|
|
||||||
<Popup
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
HorizontalOffset="-8"
|
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}"
|
Placement="BottomEdgeAlignedLeft"
|
||||||
VerticalOffset="-4">
|
PlacementTarget="{TemplateBinding}">
|
||||||
<Border
|
<Border
|
||||||
Margin="8"
|
Margin="4"
|
||||||
Background="Transparent"
|
|
||||||
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
|
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
|
||||||
CornerRadius="{DynamicResource CalendarCornerRadius}">
|
CornerRadius="{DynamicResource CalendarCornerRadius}">
|
||||||
<Calendar
|
<Calendar
|
||||||
Name="PART_Calendar"
|
Name="PART_Calendar"
|
||||||
CornerRadius="{Binding $parent[Border].CornerRadius}"
|
BorderThickness="0"
|
||||||
DisplayDate="{TemplateBinding DisplayDate}"
|
DisplayDate="{TemplateBinding DisplayDate}"
|
||||||
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
|
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
|
||||||
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
||||||
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
||||||
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
||||||
SelectedDate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedDate, Mode=TwoWay}">
|
SelectedDate="{TemplateBinding SelectedDate, Mode=TwoWay}" />
|
||||||
</Calendar>
|
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -2,15 +2,17 @@
|
|||||||
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:CompileBindings="True">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<CaptionButtons />
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<ControlTheme x:Key="CaptionButton" TargetType="Button">
|
<ControlTheme x:Key="CaptionButton" TargetType="Button">
|
||||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonPointeroverBackground}" />
|
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CaptionButtonPressedBackground}" />
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
||||||
<Setter Property="CornerRadius" Value="6" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Margin" Value="0, 4" />
|
<Setter Property="CornerRadius" Value="{StaticResource CaptionButtonCornerRadius}" />
|
||||||
<Setter Property="Padding" Value="4" />
|
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
|
||||||
<Setter Property="Height" Value="28" />
|
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
|
||||||
<Setter Property="Width" Value="28" />
|
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@@ -18,81 +20,76 @@
|
|||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_ContentPresenter"
|
Name="PART_ContentPresenter"
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Background="Transparent"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<Style Selector="^:pointerover /template/ ContentPresenter">
|
<Style Selector="^:pointerover">
|
||||||
<Setter Property="Background" Value="{TemplateBinding Background}" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPointeroverBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:pressed /template/ ContentPresenter">
|
<Style Selector="^:pressed">
|
||||||
<Setter Property="Background" Value="{TemplateBinding BorderBrush}" />
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type CaptionButtons}" TargetType="CaptionButtons">
|
<ControlTheme x:Key="{x:Type CaptionButtons}" TargetType="CaptionButtons">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
||||||
<Setter Property="Margin" Value="0 0 4 0" />
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="CaptionButtons">
|
<ControlTemplate TargetType="CaptionButtons">
|
||||||
<StackPanel
|
<StackPanel Orientation="Horizontal">
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
Spacing="2"
|
|
||||||
TextElement.FontSize="10">
|
|
||||||
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
|
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_FullScreenButtonIcon"
|
Name="PART_FullScreenButtonIcon"
|
||||||
Width="12"
|
Theme="{StaticResource InnerPathIcon}"
|
||||||
Height="12"
|
Data="{StaticResource WindowExpandGlyph}"
|
||||||
Data="{DynamicResource WindowExpandGlyph}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
Foreground="{Binding $parent[Button].Foreground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button Name="PART_MinimizeButton" Theme="{StaticResource CaptionButton}">
|
<Button Name="PART_MinimizeButton" Theme="{StaticResource CaptionButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Name="PART_MinimizeButtonIcon"
|
||||||
Height="12"
|
Theme="{StaticResource InnerPathIcon}"
|
||||||
Data="{DynamicResource WindowMinimizeGlyph}"
|
Data="{StaticResource WindowMinimizeGlyph}"
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
Foreground="{Binding $parent[Button].Foreground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button Name="PART_RestoreButton" Theme="{StaticResource CaptionButton}">
|
<Button Name="PART_RestoreButton" Theme="{StaticResource CaptionButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_RestoreButtonIcon"
|
Name="PART_RestoreButtonIcon"
|
||||||
Width="12"
|
Theme="{StaticResource InnerPathIcon}"
|
||||||
Height="12"
|
Data="{StaticResource WindowMaximizeGlyph}"
|
||||||
Data="{DynamicResource WindowMaximizeGlyph}"
|
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
Foreground="{Binding $parent[Button].Foreground}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button Name="PART_CloseButton" Theme="{StaticResource CaptionButton}">
|
||||||
Name="PART_CloseButton"
|
|
||||||
Background="{DynamicResource CaptionButtonClosePointeroverBackground}"
|
|
||||||
BorderBrush="{DynamicResource CaptionButtonClosePressedBackground}"
|
|
||||||
Theme="{StaticResource CaptionButton}">
|
|
||||||
<Button.Styles>
|
|
||||||
<Style Selector="Button:pointerover">
|
|
||||||
<Setter Property="Foreground" Value="White" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Button:pressed">
|
|
||||||
<Setter Property="Foreground" Value="White" />
|
|
||||||
</Style>
|
|
||||||
</Button.Styles>
|
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Name="PART_CloseButtonIcon"
|
||||||
Height="12"
|
Theme="{StaticResource InnerPathIcon}"
|
||||||
Data="{DynamicResource WindowCloseIconGlyph}"
|
Data="{StaticResource WindowCloseIconGlyph}"
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
Foreground="{Binding $parent[Button].Foreground}" />
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^ /template/ Button#PART_CloseButton:pointerover">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ Button#PART_CloseButton:pressed">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePressedBackground}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:maximized /template/ PathIcon#PART_RestoreButtonIcon">
|
<Style Selector="^:maximized /template/ PathIcon#PART_RestoreButtonIcon">
|
||||||
<Setter Property="Data" Value="{DynamicResource WindowRestoreGlyph}" />
|
<Setter Property="Data" Value="{StaticResource WindowRestoreGlyph}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
|
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
|
||||||
<Setter Property="Data" Value="{DynamicResource WindowCollapseGlyph}" />
|
<Setter Property="Data" Value="{StaticResource WindowCollapseGlyph}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
|
<Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
|
||||||
<Setter Property="IsVisible" Value="False" />
|
<Setter Property="IsVisible" Value="False" />
|
||||||
@@ -101,4 +98,4 @@
|
|||||||
<Setter Property="IsVisible" Value="False" />
|
<Setter Property="IsVisible" Value="False" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,9 +1,66 @@
|
|||||||
<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="clr-namespace:Semi.Avalonia.Converters"
|
xmlns:converter="clr-namespace:Semi.Avalonia.Converters"
|
||||||
x:CompileBindings="True">
|
x:CompileBindings="True">
|
||||||
<converters:ItemToObjectConverter x:Key="ItemsConverter" />
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Spacing="20" Width="800" Height="800">
|
||||||
|
<StackPanel.Styles>
|
||||||
|
<Style Selector="Carousel">
|
||||||
|
<Setter Property="Height" Value="200" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="TextBlock">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Foreground" Value="#1C1F23" />
|
||||||
|
</Style>
|
||||||
|
</StackPanel.Styles>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
|
Classes="Line">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
|
Classes="Columnar Left">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
<ControlTheme x:Key="{x:Type Carousel}" TargetType="Carousel">
|
<ControlTheme x:Key="{x:Type Carousel}" TargetType="Carousel">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
@@ -25,123 +82,94 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorDotListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorDotListBoxItem" TargetType="ListBoxItem">
|
||||||
<!-- Use fit in different color themes, Use Foreground to normal, Background to hover, BorderBrush to Selected -->
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorForeground}" />
|
||||||
|
<Setter Property="Margin" Value="4 0"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel>
|
<Ellipse
|
||||||
<Border Padding="4" Background="Transparent">
|
Name="Container"
|
||||||
<Ellipse
|
Width="{DynamicResource CarouselIndicatorDotWidth}"
|
||||||
Name="Container"
|
Height="{DynamicResource CarouselIndicatorDotHeight}"
|
||||||
Width="{DynamicResource CarouselIndicatorWidth}"
|
Fill="{TemplateBinding Foreground}" />
|
||||||
Height="{DynamicResource CarouselIndicatorHeight}"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Fill="{TemplateBinding Foreground}" />
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Ellipse#Container">
|
<Style Selector="^:pointerover">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pressed /template/ Ellipse#Container">
|
<Style Selector="^:pressed">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:selected /template/ Ellipse#Container">
|
<Style Selector="^:selected">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorLineListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorLineListBoxItem"
|
||||||
<!-- Use fit in different color themes, Use Foreground to normal, Background to hover, BorderBrush to Selected -->
|
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
TargetType="ListBoxItem">
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorForeground}" />
|
<Setter Property="Margin" Value="2 0"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel Background="Transparent">
|
<Rectangle
|
||||||
<Border Padding="2,0" Background="Transparent">
|
Name="Container"
|
||||||
<Border
|
Height="{DynamicResource CarouselIndicatorLineHeight}"
|
||||||
Name="Container"
|
Fill="{TemplateBinding Foreground}" />
|
||||||
Width="{DynamicResource CarouselIndicatorLineWidth}"
|
|
||||||
Height="{DynamicResource CarouselIndicatorLineHeight}"
|
|
||||||
Background="{TemplateBinding Background}" />
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:selected /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorColumnarListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorColumnarListBoxItem"
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorForeground}" />
|
TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Width" Value="{DynamicResource CarouselIndicatorColumnarWidth}"/>
|
||||||
|
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}"/>
|
||||||
|
<Setter Property="Margin" Value="2 0"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel Background="Transparent">
|
<Rectangle
|
||||||
<Border Padding="2,0" Background="Transparent">
|
Name="Container"
|
||||||
<Border Width="{DynamicResource CarouselIndicatorColumnarWidth}" Height="{DynamicResource CarouselIndicatorColumnarSelectedHeight}">
|
Width="{DynamicResource CarouselIndicatorColumnarWidth}"
|
||||||
<Rectangle
|
Height="{DynamicResource CarouselIndicatorColumnarHeight}"
|
||||||
Name="Container"
|
VerticalAlignment="Bottom"
|
||||||
Width="{DynamicResource CarouselIndicatorColumnarWidth}"
|
Fill="{TemplateBinding Foreground}">
|
||||||
Height="{DynamicResource CarouselIndicatorColumnarHeight}"
|
<Rectangle.Transitions>
|
||||||
VerticalAlignment="Bottom"
|
<Transitions>
|
||||||
Fill="{TemplateBinding Background}">
|
<DoubleTransition Property="Height" Duration="0:0:0.2" />
|
||||||
<Rectangle.Transitions>
|
</Transitions>
|
||||||
<Transitions>
|
</Rectangle.Transitions>
|
||||||
<DoubleTransition Property="Height" Duration="0:0:0.2" />
|
</Rectangle>
|
||||||
</Transitions>
|
|
||||||
</Rectangle.Transitions>
|
|
||||||
</Rectangle>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Rectangle#Container">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Rectangle#Container">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:selected /template/ Rectangle#Container">
|
<Style Selector="^:selected /template/ Rectangle#Container">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
|
||||||
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}" />
|
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselButton" TargetType="Button">
|
<ControlTheme x:Key="CarouselButton" TargetType="Button">
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Width" Value="32" />
|
||||||
|
<Setter Property="Height" Value="32" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonForeground}" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Grid Background="Transparent">
|
<PathIcon
|
||||||
<PathIcon
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="24"
|
Width="{TemplateBinding Width}"
|
||||||
Height="24"
|
Height="{TemplateBinding Height}"
|
||||||
Data="{DynamicResource CarouselButtonGlyph}"
|
Data="{DynamicResource CarouselButtonGlyph}"
|
||||||
Foreground="{TemplateBinding Foreground}" />
|
Foreground="{TemplateBinding Foreground}" />
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ PathIcon">
|
<Style Selector="^:pointerover /template/ PathIcon">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPointeroverForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPointeroverForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pointerover /template/ PathIcon">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="FullCarousel" TargetType="Carousel">
|
<ControlTheme x:Key="FullCarousel" TargetType="Carousel">
|
||||||
|
<Setter Property="PageTransition">
|
||||||
|
<PageSlide Orientation="Horizontal" Duration="0.3" />
|
||||||
|
</Setter>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Carousel">
|
<ControlTemplate TargetType="Carousel">
|
||||||
<Grid ColumnDefinitions="Auto, *, Auto" RowDefinitions="*, Auto">
|
<Grid ColumnDefinitions="Auto, *, Auto" RowDefinitions="*, Auto">
|
||||||
@@ -164,16 +192,15 @@
|
|||||||
<ListBox
|
<ListBox
|
||||||
Name="PART_ItemsPresenter2"
|
Name="PART_ItemsPresenter2"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="0"
|
||||||
MaxHeight="30"
|
Grid.ColumnSpan="3"
|
||||||
Margin="0,8"
|
Margin="32"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
|
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
|
||||||
ItemsSource="{TemplateBinding ItemCount,
|
ItemsSource="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemToObjectConverter}}"
|
||||||
Mode=OneWay,
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
Converter={StaticResource ItemsConverter}}"
|
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
|
||||||
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Orientation="Horizontal" />
|
<StackPanel Orientation="Horizontal" />
|
||||||
@@ -184,30 +211,31 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
Theme="{DynamicResource CarouselButton}"
|
||||||
Margin="{DynamicResource CarouselButtonMargin}"
|
Margin="{DynamicResource CarouselButtonMargin}"
|
||||||
VerticalAlignment="Center"
|
|
||||||
Background="{DynamicResource CarouselButtonPointeroverForeground}"
|
|
||||||
BorderBrush="{DynamicResource CarouselButtonPressedForeground}"
|
|
||||||
Command="{Binding $parent[Carousel].Previous}"
|
|
||||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||||
Theme="{DynamicResource CarouselButton}" />
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
|
Command="{Binding $parent[Carousel].Previous}" />
|
||||||
<Button
|
<Button
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
Theme="{DynamicResource CarouselButton}"
|
||||||
Margin="{DynamicResource CarouselButtonMargin}"
|
Margin="{DynamicResource CarouselButtonMargin}"
|
||||||
VerticalAlignment="Center"
|
|
||||||
Background="{DynamicResource CarouselButtonPointeroverForeground}"
|
|
||||||
BorderBrush="{DynamicResource CarouselButtonPressedForeground}"
|
|
||||||
Command="{Binding $parent[Carousel].Next}"
|
|
||||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||||
RenderTransform="rotate(180deg)"
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
Theme="{DynamicResource CarouselButton}" />
|
Command="{Binding $parent[Carousel].Next}"
|
||||||
|
RenderTransform="rotate(180deg)" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^.Line /template/ ListBox#PART_ItemsPresenter2">
|
<Style Selector="^.Line /template/ ListBox#PART_ItemsPresenter2">
|
||||||
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorLineListBoxItem}" />
|
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorLineListBoxItem}" />
|
||||||
|
<Setter Property="ItemsPanel">
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="{TemplateBinding ItemCount}" Rows="1" Width="240" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^.Columnar /template/ ListBox#PART_ItemsPresenter2">
|
<Style Selector="^.Columnar /template/ ListBox#PART_ItemsPresenter2">
|
||||||
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorColumnarListBoxItem}" />
|
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorColumnarListBoxItem}" />
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="CheckGlyph"
|
Name="CheckGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
||||||
@@ -217,6 +218,7 @@
|
|||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="CheckGlyph"
|
Name="CheckGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
||||||
@@ -368,6 +370,7 @@
|
|||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="CheckGlyph"
|
Name="CheckGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
||||||
|
|||||||
@@ -76,23 +76,22 @@
|
|||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Content="{TemplateBinding SelectionBoxItem}"
|
Content="{TemplateBinding SelectionBoxItem}"
|
||||||
ContentTemplate="{TemplateBinding ItemTemplate}" />
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" />
|
||||||
<Button
|
<Button
|
||||||
Name="ClearButton"
|
Name="ClearButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{DynamicResource ComboBoxClearButtonMargin}"
|
Theme="{DynamicResource InnerIconButton}"
|
||||||
|
Width="{DynamicResource ComboBoxIconWidth}"
|
||||||
Command="{Binding $parent[ComboBox].Clear}"
|
Command="{Binding $parent[ComboBox].Clear}"
|
||||||
Content="{DynamicResource IconButtonClearData}"
|
Content="{DynamicResource IconButtonClearData}"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
IsVisible="False"
|
IsVisible="False" />
|
||||||
Theme="{DynamicResource InnerIconButton}" />
|
|
||||||
|
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="DropDownGlyph"
|
Name="DropDownGlyph"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource ComboBoxIconWidth}"
|
Width="{DynamicResource ComboBoxIconWidth}"
|
||||||
Height="{DynamicResource ComboBoxIconHeight}"
|
|
||||||
Margin="{DynamicResource ComboBoxIconMargin}"
|
|
||||||
Data="{DynamicResource ComboBoxIcon}"
|
Data="{DynamicResource ComboBoxIcon}"
|
||||||
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
|
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
@@ -101,9 +100,7 @@
|
|||||||
<Popup
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
ClipToBounds="False"
|
|
||||||
InheritsTransform="True"
|
InheritsTransform="True"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
|
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
|
||||||
@@ -112,24 +109,22 @@
|
|||||||
<Border
|
<Border
|
||||||
Name="PopupBorder"
|
Name="PopupBorder"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
Margin="{DynamicResource ComboBoxPopupBorderMargin}"
|
||||||
|
Padding="{DynamicResource ComboBoxPopupBorderPadding}"
|
||||||
Background="{DynamicResource ComboBoxPopupBackground}"
|
Background="{DynamicResource ComboBoxPopupBackground}"
|
||||||
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
|
||||||
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
|
||||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||||
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}">
|
||||||
<Border
|
<ScrollViewer
|
||||||
CornerRadius="{DynamicResource ComboBoxPopupBoxCornerRadius}"
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
ClipToBounds="True">
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||||
<ScrollViewer
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
<ItemsPresenter
|
||||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
Name="PART_ItemsPresenter"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||||
<ItemsPresenter
|
</ScrollViewer>
|
||||||
Name="PART_ItemsPresenter"
|
|
||||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
|
||||||
</ScrollViewer>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -71,14 +71,12 @@
|
|||||||
Name="PART_FirstSpacer"
|
Name="PART_FirstSpacer"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="1"
|
Width="1"
|
||||||
Margin="0,4"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Name="PART_SecondSpacer"
|
Name="PART_SecondSpacer"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Width="1"
|
Width="1"
|
||||||
Margin="0,4"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -107,7 +105,6 @@
|
|||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
FontSize="16"
|
|
||||||
Theme="{StaticResource DateTimePickerButton}">
|
Theme="{StaticResource DateTimePickerButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Width="12"
|
||||||
@@ -172,7 +169,6 @@
|
|||||||
<Grid
|
<Grid
|
||||||
Name="PART_ButtonContentGrid"
|
Name="PART_ButtonContentGrid"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
|
||||||
ColumnDefinitions="78*,Auto,132*,Auto,78*">
|
ColumnDefinitions="78*,Auto,132*,Auto,78*">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Name="PART_DayTextBlock"
|
Name="PART_DayTextBlock"
|
||||||
@@ -206,24 +202,19 @@
|
|||||||
Name="PART_FirstSpacer"
|
Name="PART_FirstSpacer"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="1"
|
Width="1"
|
||||||
Height="{TemplateBinding Height}"
|
|
||||||
MinHeight="{TemplateBinding MinHeight}"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Name="PART_SecondSpacer"
|
Name="PART_SecondSpacer"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Width="1"
|
Width="1"
|
||||||
Height="{TemplateBinding Height}"
|
|
||||||
MinHeight="{TemplateBinding MinHeight}"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_Icon"
|
Name="PART_Icon"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Data="{DynamicResource DatePickerIconGlyph}"
|
Data="{DynamicResource DatePickerIconGlyph}"
|
||||||
Foreground="{DynamicResource DateTimePickerIconForeground}" />
|
Foreground="{DynamicResource DateTimePickerIconForeground}" />
|
||||||
@@ -242,11 +233,11 @@
|
|||||||
<Button
|
<Button
|
||||||
Name="ClearButton"
|
Name="ClearButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="0,0,8,0"
|
Theme="{DynamicResource InnerIconButton}"
|
||||||
|
Margin="0,0,9,0"
|
||||||
Command="{Binding $parent[DatePicker].Clear}"
|
Command="{Binding $parent[DatePicker].Clear}"
|
||||||
Content="{DynamicResource IconButtonClearData}"
|
Content="{DynamicResource IconButtonClearData}"
|
||||||
IsVisible="False"
|
IsVisible="False" />
|
||||||
Theme="{DynamicResource InnerIconButton}" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataValidationErrors>
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|||||||
@@ -43,8 +43,7 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Name="DropDownGlyph"
|
Name="DropDownGlyph"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="12"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="12"
|
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|||||||
@@ -50,9 +50,9 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_PathIcon"
|
Name="PART_PathIcon"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="{DynamicResource ExpanderIconSize}"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="{DynamicResource ExpanderIconSize}"
|
Margin="{DynamicResource ExpanderIconMargin}"
|
||||||
Data="M4.08045 7.59809C4.66624 7.01231 5.61599 7.01231 6.20177 7.59809L11.8586 13.2549L17.5155 7.59809C18.1013 7.01231 19.051 7.01231 19.6368 7.59809C20.2226 8.18388 20.2226 9.13363 19.6368 9.71941L12.9193 16.4369C12.3335 17.0227 11.3838 17.0227 10.798 16.4369L4.08045 9.71941C3.49467 9.13363 3.49467 8.18388 4.08045 7.59809Z">
|
Data="{DynamicResource ExpanderIcon}">
|
||||||
<PathIcon.Transitions>
|
<PathIcon.Transitions>
|
||||||
<Transitions>
|
<Transitions>
|
||||||
<TransformOperationsTransition Property="RenderTransform" Duration="0.1" />
|
<TransformOperationsTransition Property="RenderTransform" Duration="0.1" />
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto">
|
<Grid RowDefinitions="Auto,Auto,*">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_HeaderPresenter"
|
Name="PART_HeaderPresenter"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
<DockPanel>
|
<DockPanel>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_LinkGlyph"
|
Name="PART_LinkGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Margin="{DynamicResource HyperlinkButtonLinkGlyphMargin}"
|
Margin="{DynamicResource HyperlinkButtonLinkGlyphMargin}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Data="{DynamicResource HyperlinkButtonLinkGlyph}"
|
Data="{DynamicResource HyperlinkButtonLinkGlyph}"
|
||||||
@@ -82,7 +83,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^.Underline">
|
<Style Selector="^.Underline">
|
||||||
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter:pointerover">
|
||||||
<Setter Property="TextBlock.TextDecorations" Value="Underline" />
|
<Setter Property="TextBlock.TextDecorations" Value="Underline" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -572,6 +572,7 @@
|
|||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="CheckGlyph"
|
Name="CheckGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
||||||
@@ -750,6 +751,7 @@
|
|||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="CheckGlyph"
|
Name="CheckGlyph"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
Width="{DynamicResource CheckBoxBoxGlyphWidth}"
|
||||||
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
Height="{DynamicResource CheckBoxBoxGlyphHeight}"
|
||||||
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
Foreground="{DynamicResource CheckBoxGlyphFill}" />
|
||||||
|
|||||||
@@ -38,8 +38,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="4">
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
||||||
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
||||||
<TextBlock Foreground="{DynamicResource ManagedFileChooserTextForeground}" Text="{Binding DisplayName}" />
|
<TextBlock Foreground="{DynamicResource ManagedFileChooserTextForeground}" Text="{Binding DisplayName}" />
|
||||||
@@ -58,8 +57,7 @@
|
|||||||
DockPanel.Dock="Left"
|
DockPanel.Dock="Left"
|
||||||
Theme="{DynamicResource BorderlessButton}">
|
Theme="{DynamicResource BorderlessButton}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource ManagedFileChooserUpButtonGlyph}"
|
Data="{DynamicResource ManagedFileChooserUpButtonGlyph}"
|
||||||
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -159,8 +157,7 @@
|
|||||||
<ColumnDefinition SharedSizeGroup="Size" />
|
<ColumnDefinition SharedSizeGroup="Size" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
||||||
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|||||||
@@ -10,83 +10,79 @@
|
|||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ScrollViewer">
|
<ControlTemplate TargetType="ScrollViewer">
|
||||||
<Border
|
<DockPanel>
|
||||||
ClipToBounds="True"
|
<DockPanel.Styles>
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
<Style Selector="RepeatButton:pressed">
|
||||||
<DockPanel>
|
<Setter Property="RenderTransform" Value="{x:Null}" />
|
||||||
<DockPanel.Styles>
|
</Style>
|
||||||
<Style Selector="RepeatButton:pressed">
|
</DockPanel.Styles>
|
||||||
<Setter Property="RenderTransform" Value="{x:Null}" />
|
<RepeatButton
|
||||||
</Style>
|
HorizontalAlignment="Stretch"
|
||||||
</DockPanel.Styles>
|
HorizontalContentAlignment="Center"
|
||||||
<RepeatButton
|
Background="Transparent"
|
||||||
HorizontalAlignment="Stretch"
|
BorderThickness="0"
|
||||||
HorizontalContentAlignment="Center"
|
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Background="Transparent"
|
CornerRadius="0"
|
||||||
BorderThickness="0"
|
MinHeight="0"
|
||||||
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
|
DockPanel.Dock="Top"
|
||||||
CornerRadius="0"
|
RenderTransform="{x:Null}">
|
||||||
DockPanel.Dock="Top"
|
<RepeatButton.IsVisible>
|
||||||
RenderTransform="{x:Null}">
|
<MultiBinding
|
||||||
<RepeatButton.IsVisible>
|
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
||||||
<MultiBinding
|
ConverterParameter="0">
|
||||||
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
<Binding Path="VerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
ConverterParameter="0">
|
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
<Binding Path="VerticalScrollBarVisibility"
|
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
|
</MultiBinding>
|
||||||
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
</RepeatButton.IsVisible>
|
||||||
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
<PathIcon
|
||||||
</MultiBinding>
|
Width="8"
|
||||||
</RepeatButton.IsVisible>
|
Height="8"
|
||||||
<PathIcon
|
Data="{DynamicResource MenuScrollViewerUpButtonGlyph}"
|
||||||
Width="8"
|
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
|
||||||
Height="8"
|
</RepeatButton>
|
||||||
Data="{DynamicResource MenuScrollViewerUpButtonGlyph}"
|
<RepeatButton
|
||||||
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
|
HorizontalAlignment="Stretch"
|
||||||
</RepeatButton>
|
HorizontalContentAlignment="Center"
|
||||||
<RepeatButton
|
Background="Transparent"
|
||||||
HorizontalAlignment="Stretch"
|
BorderThickness="0"
|
||||||
HorizontalContentAlignment="Center"
|
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Background="Transparent"
|
CornerRadius="0"
|
||||||
BorderThickness="0"
|
DockPanel.Dock="Bottom"
|
||||||
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
|
MinHeight="0"
|
||||||
CornerRadius="0"
|
RenderTransform="{x:Null}">
|
||||||
DockPanel.Dock="Bottom"
|
<RepeatButton.IsVisible>
|
||||||
RenderTransform="{x:Null}">
|
<MultiBinding
|
||||||
<RepeatButton.IsVisible>
|
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
||||||
<MultiBinding
|
ConverterParameter="100">
|
||||||
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
<Binding Path="VerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
ConverterParameter="100">
|
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
<Binding Path="VerticalScrollBarVisibility"
|
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
|
</MultiBinding>
|
||||||
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
</RepeatButton.IsVisible>
|
||||||
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
|
<PathIcon
|
||||||
</MultiBinding>
|
Width="8"
|
||||||
</RepeatButton.IsVisible>
|
Height="8"
|
||||||
<PathIcon
|
Data="{DynamicResource MenuScrollViewerDownButtonGlyph}"
|
||||||
Width="8"
|
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
|
||||||
Height="8"
|
</RepeatButton>
|
||||||
Data="{DynamicResource MenuScrollViewerDownButtonGlyph}"
|
<ScrollContentPresenter
|
||||||
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
|
Name="PART_ContentPresenter"
|
||||||
</RepeatButton>
|
Margin="{TemplateBinding Padding}"
|
||||||
<ScrollContentPresenter
|
HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}"
|
||||||
Name="PART_ContentPresenter"
|
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
|
||||||
Margin="{TemplateBinding Padding}"
|
VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}"
|
||||||
HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}"
|
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}">
|
||||||
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
|
<ScrollContentPresenter.GestureRecognizers>
|
||||||
VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}"
|
<ScrollGestureRecognizer
|
||||||
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}">
|
CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
|
||||||
<ScrollContentPresenter.GestureRecognizers>
|
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}"
|
||||||
<ScrollGestureRecognizer
|
IsScrollInertiaEnabled="{Binding IsScrollInertiaEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
|
</ScrollContentPresenter.GestureRecognizers>
|
||||||
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}"
|
</ScrollContentPresenter>
|
||||||
IsScrollInertiaEnabled="{Binding IsScrollInertiaEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
|
</DockPanel>
|
||||||
</ScrollContentPresenter.GestureRecognizers>
|
|
||||||
</ScrollContentPresenter>
|
|
||||||
</DockPanel>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
@@ -115,7 +111,6 @@
|
|||||||
<ControlTheme x:Key="{x:Type MenuItem}" TargetType="MenuItem">
|
<ControlTheme x:Key="{x:Type MenuItem}" TargetType="MenuItem">
|
||||||
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
|
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" />
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
|
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
|
||||||
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
|
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
|
||||||
@@ -184,8 +179,7 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_ExpandIcon"
|
Name="PART_ExpandIcon"
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
Width="8"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="8"
|
|
||||||
Margin="{DynamicResource MenuItemExpandIconMargin}"
|
Margin="{DynamicResource MenuItemExpandIconMargin}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Data="{DynamicResource MenuItemExpandIconGlyph}"
|
Data="{DynamicResource MenuItemExpandIconGlyph}"
|
||||||
@@ -283,6 +277,7 @@
|
|||||||
<Setter Property="Content">
|
<Setter Property="Content">
|
||||||
<Template>
|
<Template>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Foreground="{Binding $parent[MenuItem].Foreground}"
|
Foreground="{Binding $parent[MenuItem].Foreground}"
|
||||||
Data="{StaticResource MenuCheckGlyph}" />
|
Data="{StaticResource MenuCheckGlyph}" />
|
||||||
</Template>
|
</Template>
|
||||||
@@ -294,7 +289,7 @@
|
|||||||
<Setter Property="Content">
|
<Setter Property="Content">
|
||||||
<Template>
|
<Template>
|
||||||
<Ellipse Fill="{Binding $parent[MenuItem].Foreground}"
|
<Ellipse Fill="{Binding $parent[MenuItem].Foreground}"
|
||||||
Margin="4" Width="8" Height="8" />
|
Margin="4" Width="6" Height="6" />
|
||||||
</Template>
|
</Template>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
@@ -304,7 +299,7 @@
|
|||||||
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
|
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}"/>
|
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" />
|
||||||
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
|
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
|
||||||
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
|
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@@ -403,4 +398,4 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
<DockPanel MinWidth="{DynamicResource NotificationCardMinWidth}">
|
<DockPanel MinWidth="{DynamicResource NotificationCardMinWidth}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Name="NotificationIcon"
|
Name="NotificationIcon"
|
||||||
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Width="{DynamicResource NotificationCardIconWidth}"
|
Width="{DynamicResource NotificationCardIconWidth}"
|
||||||
Height="{DynamicResource NotificationCardIconHeight}"
|
Height="{DynamicResource NotificationCardIconHeight}"
|
||||||
Margin="{DynamicResource NotificationCardIconMargin}"
|
Margin="{DynamicResource NotificationCardIconMargin}"
|
||||||
|
|||||||
@@ -20,7 +20,48 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^.Active /template/ Path#PART_Path">
|
<Style Selector="^.Active /template/ Path#PART_Path">
|
||||||
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}"></Setter>
|
<Setter Property="Fill" Value="{TemplateBinding BorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
|
||||||
|
<ControlTheme x:Key="InnerPathIcon" TargetType="PathIcon">
|
||||||
|
<Setter Property="Height" Value="16" />
|
||||||
|
<Setter Property="Width" Value="16" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate TargetType="PathIcon">
|
||||||
|
<Border Background="{TemplateBinding Background}">
|
||||||
|
<Viewbox
|
||||||
|
Width="{TemplateBinding Width}"
|
||||||
|
Height="{TemplateBinding Height}">
|
||||||
|
<Path
|
||||||
|
Name="PART_Path"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
Data="{TemplateBinding Data}"
|
||||||
|
Fill="{TemplateBinding Foreground}" />
|
||||||
|
</Viewbox>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
<Style Selector="^.Active /template/ Path#PART_Path">
|
||||||
|
<Setter Property="Fill" Value="{TemplateBinding BorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.ExtraSmall">
|
||||||
|
<Setter Property="Height" Value="8" />
|
||||||
|
<Setter Property="Width" Value="8" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.Small">
|
||||||
|
<Setter Property="Height" Value="12" />
|
||||||
|
<Setter Property="Width" Value="12" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.Large">
|
||||||
|
<Setter Property="Height" Value="20" />
|
||||||
|
<Setter Property="Width" Value="20" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.ExtraLarge">
|
||||||
|
<Setter Property="Height" Value="24" />
|
||||||
|
<Setter Property="Width" Value="24" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -11,12 +11,14 @@
|
|||||||
<Panel>
|
<Panel>
|
||||||
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
|
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
|
||||||
<VisualLayerManager IsPopup="True">
|
<VisualLayerManager IsPopup="True">
|
||||||
<ContentPresenter
|
<LayoutTransformControl Name="PART_LayoutTransform">
|
||||||
Name="PART_ContentPresenter"
|
<ContentPresenter
|
||||||
Padding="{TemplateBinding Padding}"
|
Name="PART_ContentPresenter"
|
||||||
Background="{TemplateBinding Background}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Content="{TemplateBinding Content}"
|
Background="{TemplateBinding Background}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
|
</LayoutTransformControl>
|
||||||
</VisualLayerManager>
|
</VisualLayerManager>
|
||||||
</Panel>
|
</Panel>
|
||||||
</LayoutTransformControl>
|
</LayoutTransformControl>
|
||||||
@@ -29,12 +31,14 @@
|
|||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
|
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
|
||||||
<VisualLayerManager IsPopup="True">
|
<VisualLayerManager IsPopup="True">
|
||||||
<ContentPresenter
|
<LayoutTransformControl Name="PART_LayoutTransform">
|
||||||
Name="PART_ContentPresenter"
|
<ContentPresenter
|
||||||
Padding="{TemplateBinding Padding}"
|
Name="PART_ContentPresenter"
|
||||||
Background="{TemplateBinding Background}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Content="{TemplateBinding Content}"
|
Background="{TemplateBinding Background}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
|
</LayoutTransformControl>
|
||||||
</VisualLayerManager>
|
</VisualLayerManager>
|
||||||
</LayoutTransformControl>
|
</LayoutTransformControl>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
Width="{DynamicResource SplitButtonSeparatorWidth}"
|
Width="{DynamicResource SplitButtonSeparatorWidth}"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
DockPanel.Dock="Left"
|
DockPanel.Dock="Left"
|
||||||
Fill="{TemplateBinding BorderBrush}"
|
Fill="Transparent"
|
||||||
StrokeThickness="0" />
|
StrokeThickness="0" />
|
||||||
<Button
|
<Button
|
||||||
Name="PART_SecondaryButton"
|
Name="PART_SecondaryButton"
|
||||||
@@ -103,8 +103,7 @@
|
|||||||
CornerRadius="0"
|
CornerRadius="0"
|
||||||
Theme="{DynamicResource SemiSplitButtonElement}">
|
Theme="{DynamicResource SemiSplitButtonElement}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="12"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="12"
|
|
||||||
Data="{DynamicResource SplitButtonIconGlyph}"
|
Data="{DynamicResource SplitButtonIconGlyph}"
|
||||||
Foreground="{Binding $parent[Button].Foreground}" />
|
Foreground="{Binding $parent[Button].Foreground}" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -172,6 +172,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
|
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
|
||||||
|
<Setter Property="PasswordChar" Value="•"/>
|
||||||
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
|
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
|
||||||
<Setter Property="IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
@@ -379,6 +380,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
|
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
|
||||||
|
<Setter Property="PasswordChar" Value="•"/>
|
||||||
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
|
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
|
||||||
<Setter Property="IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
@@ -510,22 +512,26 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
|
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
|
||||||
|
<Setter Property="Width" Value="16"/>
|
||||||
|
<Setter Property="Height" Value="16"/>
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
||||||
|
<!-- Background must be transparent or hit test will fail -->
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ToggleButton">
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
<!-- Background must be transparent or hit test will fail -->
|
<Panel
|
||||||
<Panel Background="Transparent">
|
Width="{TemplateBinding Width}"
|
||||||
|
Height="{TemplateBinding Height}"
|
||||||
|
Background="{TemplateBinding Background}">
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource PasswordBoxRevealButtonData}"
|
Data="{DynamicResource PasswordBoxRevealButtonData}"
|
||||||
IsVisible="{Binding $parent[ToggleButton].IsChecked, Converter={x:Static BoolConverters.Not}}" />
|
IsVisible="{TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource PasswordBoxHideButtonData}"
|
Data="{DynamicResource PasswordBoxHideButtonData}"
|
||||||
IsVisible="{Binding $parent[ToggleButton].IsChecked}" />
|
IsVisible="{TemplateBinding IsChecked}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|||||||
@@ -86,21 +86,18 @@
|
|||||||
Name="PART_FirstSpacer"
|
Name="PART_FirstSpacer"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="1"
|
Width="1"
|
||||||
Margin="0,4"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Name="PART_SecondSpacer"
|
Name="PART_SecondSpacer"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Width="1"
|
Width="1"
|
||||||
Margin="0,4"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Name="PART_ThirdSpacer"
|
Name="PART_ThirdSpacer"
|
||||||
Grid.Column="5"
|
Grid.Column="5"
|
||||||
Width="1"
|
Width="1"
|
||||||
Margin="0,4"
|
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -280,8 +277,7 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_Icon"
|
Name="PART_Icon"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="16"
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Height="16"
|
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
Data="{DynamicResource TimePickerIconGlyph}"
|
Data="{DynamicResource TimePickerIconGlyph}"
|
||||||
Foreground="{DynamicResource DateTimePickerIconForeground}" />
|
Foreground="{DynamicResource DateTimePickerIconForeground}" />
|
||||||
@@ -303,11 +299,11 @@
|
|||||||
<Button
|
<Button
|
||||||
Name="ClearButton"
|
Name="ClearButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="0,0,8,0"
|
Theme="{DynamicResource InnerIconButton}"
|
||||||
|
Margin="0,0,9,0"
|
||||||
Command="{Binding $parent[TimePicker].Clear}"
|
Command="{Binding $parent[TimePicker].Clear}"
|
||||||
Content="{DynamicResource IconButtonClearData}"
|
Content="{DynamicResource IconButtonClearData}"
|
||||||
IsVisible="False"
|
IsVisible="False" />
|
||||||
Theme="{DynamicResource InnerIconButton}" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataValidationErrors>
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|||||||
@@ -3,22 +3,45 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:CompileBindings="True">
|
x:CompileBindings="True">
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<StackPanel Margin="20">
|
<ThemeVariantScope RequestedThemeVariant="Dark">
|
||||||
<ToggleSwitch
|
<StackPanel Spacing="8" Background="{DynamicResource SemiBackground0Color}">
|
||||||
Content="Content"
|
<StackPanel Orientation="Horizontal">
|
||||||
OffContent="OffContent"
|
<ToggleSwitch Classes="Small" />
|
||||||
OnContent="OnContent" />
|
<ToggleSwitch Classes="Small" IsChecked="True" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch />
|
||||||
|
<ToggleSwitch IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch Classes="Large" />
|
||||||
|
<ToggleSwitch Classes="Large" IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" Classes="Small" />
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" Classes="Small" IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" />
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" Classes="Large" />
|
||||||
|
<ToggleSwitch Theme="{DynamicResource SimpleToggleSwitch}" OnContent="是" OffContent="否" Classes="Large" IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</ThemeVariantScope>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
<ControlTheme x:Key="{x:Type ToggleSwitch}" TargetType="ToggleSwitch">
|
<ControlTheme x:Key="{x:Type ToggleSwitch}" TargetType="ToggleSwitch">
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="FocusAdorner">
|
<Setter Property="FocusAdorner">
|
||||||
<FocusAdornerTemplate>
|
<FocusAdornerTemplate>
|
||||||
<Border Theme="{DynamicResource AdornerLayerBorder}"
|
<Border Theme="{DynamicResource AdornerLayerBorder}"
|
||||||
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}"/>
|
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}" />
|
||||||
</FocusAdornerTemplate>
|
</FocusAdornerTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="KnobTransitions">
|
<Setter Property="KnobTransitions">
|
||||||
@@ -32,9 +55,7 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ToggleSwitch">
|
<ControlTemplate TargetType="ToggleSwitch">
|
||||||
<Grid
|
<Grid
|
||||||
Background="{TemplateBinding Background}"
|
RowDefinitions="Auto, *"
|
||||||
Cursor="Hand"
|
|
||||||
RowDefinitions="Auto,*"
|
|
||||||
ColumnDefinitions="Auto, *">
|
ColumnDefinitions="Auto, *">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_ContentPresenter"
|
Name="PART_ContentPresenter"
|
||||||
@@ -53,9 +74,10 @@
|
|||||||
TemplatedControl.IsTemplateFocusTarget="True"
|
TemplatedControl.IsTemplateFocusTarget="True"
|
||||||
Width="{DynamicResource ToggleSwitchDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchDefaultHeight}"
|
Height="{DynamicResource ToggleSwitchDefaultHeight}"
|
||||||
|
BackgroundSizing="OuterBorderEdge"
|
||||||
BorderBrush="{DynamicResource ToggleSwitchDefaultBorderBrush}"
|
BorderBrush="{DynamicResource ToggleSwitchDefaultBorderBrush}"
|
||||||
BorderThickness="1"
|
BorderThickness="{DynamicResource ToggleSwitchDefaultBorderThickness}"
|
||||||
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}">
|
CornerRadius="{DynamicResource ToggleSwitchDefaultCornerRadius}">
|
||||||
<Border.Transitions>
|
<Border.Transitions>
|
||||||
<Transitions>
|
<Transitions>
|
||||||
<BrushTransition Property="Background" Duration="0:0:0.2" />
|
<BrushTransition Property="Background" Duration="0:0:0.2" />
|
||||||
@@ -66,7 +88,7 @@
|
|||||||
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left">
|
||||||
<Grid
|
<Panel
|
||||||
Name="PART_MovingKnobs"
|
Name="PART_MovingKnobs"
|
||||||
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
@@ -79,7 +101,7 @@
|
|||||||
<Arc
|
<Arc
|
||||||
Name="SwitchKnobLoadingIndicator"
|
Name="SwitchKnobLoadingIndicator"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
StrokeThickness="2"
|
StrokeThickness="{DynamicResource ToggleSwitchLoadingIndicatorDefaultStrokeThickness}"
|
||||||
StartAngle="0"
|
StartAngle="0"
|
||||||
SweepAngle="140"
|
SweepAngle="140"
|
||||||
StrokeJoin="Round"
|
StrokeJoin="Round"
|
||||||
@@ -107,7 +129,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Arc.Styles>
|
</Arc.Styles>
|
||||||
</Arc>
|
</Arc>
|
||||||
</Grid>
|
</Panel>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
@@ -156,7 +178,6 @@
|
|||||||
<Style Selector="^:disabled /template/ Border#SwitchBackgroundBorder">
|
<Style Selector="^:disabled /template/ Border#SwitchBackgroundBorder">
|
||||||
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerUnCheckedDisabledBackground}" />
|
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerUnCheckedDisabledBackground}" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchContainerUnCheckedDisabledBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleSwitchContainerUnCheckedDisabledBorderBrush}" />
|
||||||
<Setter Property="BorderThickness" Value="1" />
|
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
@@ -200,15 +221,16 @@
|
|||||||
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
|
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchSmallWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchSmallWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchSmallHeight}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchSmallHeight}" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ToggleSwitchSmallCornerRadius}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
|
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
|
<Style Selector="^ /template/ Panel#PART_MovingKnobs">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
|
||||||
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorSmallMargin}"/>
|
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorSmallMargin}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
|
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
|
||||||
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorSmallStrokeThickness}" />
|
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorSmallStrokeThickness}" />
|
||||||
@@ -218,15 +240,16 @@
|
|||||||
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
|
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchLargeWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchLargeWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchLargeHeight}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchLargeHeight}" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ToggleSwitchLargeCornerRadius}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
|
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
|
<Style Selector="^ /template/ Panel#PART_MovingKnobs">
|
||||||
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
|
||||||
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorLargeMargin}"/>
|
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorLargeMargin}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
|
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
|
||||||
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorLargeStrokeThickness}" />
|
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorLargeStrokeThickness}" />
|
||||||
@@ -234,69 +257,25 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme
|
|
||||||
x:Key="ButtonToggleSwitch"
|
|
||||||
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
|
|
||||||
TargetType="ToggleSwitch">
|
|
||||||
<Setter Property="Padding" Value="8" />
|
|
||||||
<Setter Property="CornerRadius" Value="3" />
|
|
||||||
<Setter Property="Background" Value="Transparent" />
|
|
||||||
<Setter Property="FocusAdorner">
|
|
||||||
<FocusAdornerTemplate>
|
|
||||||
<Border Theme="{StaticResource AdornerLayerBorder}" />
|
|
||||||
</FocusAdornerTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Template">
|
|
||||||
<ControlTemplate TargetType="ToggleSwitch">
|
|
||||||
<Border
|
|
||||||
Name="Background"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
|
||||||
Cursor="Hand">
|
|
||||||
<Panel>
|
|
||||||
<Panel Name="PART_SwitchKnob" />
|
|
||||||
<Panel Name="PART_MovingKnobs" />
|
|
||||||
<ContentPresenter
|
|
||||||
Name="PART_OnContentPresenter"
|
|
||||||
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
|
|
||||||
Content="{TemplateBinding OnContent}"
|
|
||||||
ContentTemplate="{TemplateBinding OnContentTemplate}" />
|
|
||||||
<ContentPresenter
|
|
||||||
Name="PART_OffContentPresenter"
|
|
||||||
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
|
|
||||||
Content="{TemplateBinding OffContent}"
|
|
||||||
ContentTemplate="{TemplateBinding OffContentTemplate}" />
|
|
||||||
</Panel>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
|
|
||||||
<ControlTheme
|
<ControlTheme
|
||||||
x:Key="SimpleToggleSwitch"
|
x:Key="SimpleToggleSwitch"
|
||||||
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
|
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
|
||||||
TargetType="ToggleSwitch">
|
TargetType="ToggleSwitch">
|
||||||
<Setter Property="OnContent" Value="{x:Null}" />
|
<Setter Property="OnContent" Value="{x:Null}" />
|
||||||
<Setter Property="OffContent" Value="{x:Null}" />
|
<Setter Property="OffContent" Value="{x:Null}" />
|
||||||
|
<Setter Property="Content" Value="{x:Null}" />
|
||||||
<Setter Property="FontSize" Value="{DynamicResource SimpleToggleSwitchFontSize}" />
|
<Setter Property="FontSize" Value="{DynamicResource SimpleToggleSwitchFontSize}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ToggleSwitch">
|
<ControlTemplate TargetType="ToggleSwitch">
|
||||||
<Border
|
<Border
|
||||||
Name="SwitchBackgroundBorder"
|
Name="SwitchBackgroundBorder"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Cursor="Hand"
|
|
||||||
Width="{DynamicResource ToggleSwitchDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchDefaultHeight}"
|
Height="{DynamicResource ToggleSwitchDefaultHeight}"
|
||||||
|
BackgroundSizing="OuterBorderEdge"
|
||||||
BorderBrush="{DynamicResource ToggleSwitchDefaultBorderBrush}"
|
BorderBrush="{DynamicResource ToggleSwitchDefaultBorderBrush}"
|
||||||
BorderThickness="1"
|
BorderThickness="{DynamicResource ToggleSwitchDefaultBorderThickness}"
|
||||||
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}">
|
CornerRadius="{DynamicResource ToggleSwitchDefaultCornerRadius}">
|
||||||
<Border.Transitions>
|
<Border.Transitions>
|
||||||
<Transitions>
|
<Transitions>
|
||||||
<BrushTransition Property="Background" Duration="0:0:0.2" />
|
<BrushTransition Property="Background" Duration="0:0:0.2" />
|
||||||
@@ -311,7 +290,7 @@
|
|||||||
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left">
|
||||||
<Grid
|
<Panel
|
||||||
Name="PART_MovingKnobs"
|
Name="PART_MovingKnobs"
|
||||||
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
|
||||||
@@ -324,7 +303,7 @@
|
|||||||
<Arc
|
<Arc
|
||||||
Name="SwitchKnobLoadingIndicator"
|
Name="SwitchKnobLoadingIndicator"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
StrokeThickness="2"
|
StrokeThickness="{DynamicResource ToggleSwitchLoadingIndicatorDefaultStrokeThickness}"
|
||||||
StartAngle="0"
|
StartAngle="0"
|
||||||
SweepAngle="140"
|
SweepAngle="140"
|
||||||
StrokeJoin="Round"
|
StrokeJoin="Round"
|
||||||
@@ -352,7 +331,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Arc.Styles>
|
</Arc.Styles>
|
||||||
</Arc>
|
</Arc>
|
||||||
</Grid>
|
</Panel>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_OnContentPresenter"
|
Name="PART_OnContentPresenter"
|
||||||
@@ -391,4 +370,95 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="ButtonToggleSwitch" TargetType="ToggleSwitch">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
|
||||||
|
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
|
<Setter Property="OnContent" Value="{x:Null}" />
|
||||||
|
<Setter Property="OffContent" Value="{x:Null}" />
|
||||||
|
<Setter Property="Content" Value="{x:Null}" />
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
|
||||||
|
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate TargetType="ToggleSwitch">
|
||||||
|
<Border
|
||||||
|
Name="Background"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<Panel>
|
||||||
|
<Panel Name="PART_SwitchKnob" />
|
||||||
|
<Panel Name="PART_MovingKnobs" />
|
||||||
|
<ContentPresenter
|
||||||
|
Name="PART_OnContentPresenter"
|
||||||
|
IsVisible="{TemplateBinding IsChecked}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
Content="{TemplateBinding OnContent}"
|
||||||
|
ContentTemplate="{TemplateBinding OnContentTemplate}" />
|
||||||
|
<ContentPresenter
|
||||||
|
Name="PART_OffContentPresenter"
|
||||||
|
IsVisible="{TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
Content="{TemplateBinding OffContent}"
|
||||||
|
ContentTemplate="{TemplateBinding OffContentTemplate}" />
|
||||||
|
<ContentPresenter
|
||||||
|
Name="PART_ContentPresenter"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}">
|
||||||
|
<ContentPresenter.IsVisible>
|
||||||
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
|
<TemplateBinding Property="Content" Converter="{x:Static ObjectConverters.IsNotNull}" />
|
||||||
|
<TemplateBinding Property="OnContent" Converter="{x:Static ObjectConverters.IsNull}" />
|
||||||
|
<TemplateBinding Property="OffContent" Converter="{x:Static ObjectConverters.IsNull}" />
|
||||||
|
</MultiBinding>
|
||||||
|
</ContentPresenter.IsVisible>
|
||||||
|
</ContentPresenter>
|
||||||
|
</Panel>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^:pressed">
|
||||||
|
<Setter Property="RenderTransform" Value="scale(0.98)" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:pointerover">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPointeroverBorderBrush}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:pressed">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:disabled">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderlessBorderBrush}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ButtonBorderlessBackground}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^.Large">
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource ButtonLargeHeight}" />
|
||||||
|
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.Small">
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
|
||||||
|
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user