Compare commits

..

127 Commits

Author SHA1 Message Date
Zhang Dian
45b1c9ab73 misc: bump version. 2025-03-28 14:53:53 +08:00
Zhang Dian
b780b793c8 Merge pull request #580 from irihitech/various
Config & Separate Semi.Avalonia.DataGrid package
2025-03-28 14:51:34 +08:00
Zhang Dian
de6dc99efb misc: update Overview avalonia icon color. 2025-03-19 13:33:30 +08:00
Zhang Dian
71b1c38ec4 misc: split DataGrid package. 2025-03-19 13:33:30 +08:00
Dong Bin
992017951b Merge pull request #572 from irihitech/tree
enhance TreeDataGrid
2025-03-18 22:43:08 +08:00
Zhang Dian
a796cb828b fix: fix CollapsedChevron icon issue. 2025-03-18 22:36:12 +08:00
Dong Bin
3b41331c67 Merge pull request #573 from snail1519/SolidButton_Custom
fix: Cannot set Background for default SolidButton theme
2025-03-18 21:49:10 +08:00
snail1519
a6711ab453 Update demo/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml
Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2025-03-18 17:22:46 +08:00
snail1519
9eab777faa fix: Cannot set Background for default SolidButton theme 2025-03-18 11:34:40 +08:00
snail1519
ccdbf25004 Revert "fix: Cannot set Background for default SolidButton theme"
This reverts commit 054b6f59d5.
2025-03-18 11:30:03 +08:00
Zhang Dian
626dff4e69 feat: replace shared resources. 2025-03-18 10:24:40 +08:00
snail1519
054b6f59d5 fix: Cannot set Background for default SolidButton theme 2025-03-18 10:13:34 +08:00
Dong Bin
32687b1820 Create FUNDING.yml 2025-03-17 22:27:15 +08:00
Zhang Dian
d0b9f2d7c9 feat: enhance demo. 2025-03-17 14:10:05 +08:00
Zhang Dian
a671ee3fcb feat: replace color resources. 2025-03-17 14:10:05 +08:00
Zhang Dian
67c0db10ac feat: replace TreeDataGrid icon. 2025-03-17 14:10:05 +08:00
Zhang Dian
6cda56a830 feat: replace TreeView icon. 2025-03-17 14:08:22 +08:00
Dong Bin
d7690e464b Merge pull request #569 from irihitech/DataGrid
enhance DataGrid
2025-03-17 11:44:04 +08:00
Dong Bin
41811a84a9 Merge pull request #570 from irihitech/popup
Add some default font properties to PopupRoot
2025-03-15 19:18:16 +08:00
Zhang Dian
51abb760c9 feat: add some default font properties to PopupRoot. 2025-03-15 17:53:25 +08:00
Zhang Dian
f4c0e0d79a feat: replace shared resources. 2025-03-15 17:45:49 +08:00
Zhang Dian
c3c6ef629f misc: format codes. 2025-03-15 17:31:56 +08:00
Zhang Dian
de08d4a20f feat: replace icon. 2025-03-15 17:31:56 +08:00
Zhang Dian
9f432ddee6 feat: replace color resources. 2025-03-15 17:31:56 +08:00
Zhang Dian
21635cfb56 Merge pull request #565 from irihitech/scroll
ScrollBar Update
2025-03-14 16:39:01 +08:00
Zhang Dian
1d54b8ca4b feat: simplify ScrollViewerDemo. 2025-03-13 13:27:14 +08:00
Dong Bin
cf90be7cea feat: implementation for DataGrid. 2025-03-13 11:24:17 +08:00
Dong Bin
9aa24c066b feat: add new StyleClass to ScrollViewer: InsetContent 2025-03-13 11:15:50 +08:00
Dong Bin
d03e80d0ef Merge pull request #559 from irihitech/colorpicker
enhance Colorpicker
2025-03-13 11:04:43 +08:00
Dong Bin
5a1d87e163 Merge pull request #564 from irihitech/splitbutton
Fix the issue of HorizontalAlignment in SplitButton
2025-03-13 10:42:58 +08:00
Zhang Dian
86b2ad53fa fix: fix the issue of HorizontalAlignment in SplitButton. 2025-03-12 15:34:45 +08:00
Zhang Dian
7e33078f00 feat: support HorizontalAlignment="Stretch". 2025-03-12 13:59:32 +08:00
Vicente Penades
8022a80f0e Added spanish locale (#560)
* Added spanish locale

* fixed resource directory name

* Added spanish locale to demo

* using spanish local name
2025-03-11 23:11:14 +08:00
Zhang Dian
08552cf57e feat: some enhancements. 2025-03-11 17:01:28 +08:00
Dong Bin
ffbd8efef7 Merge pull request #552 from irihitech/typesetting
Replace kinds of Discrete Resources
2025-03-10 12:05:15 +08:00
Zhang Dian
ea182c07f0 feat: enhance ColorPicker & redesign demo. 2025-03-10 11:19:56 +08:00
Zhang Dian
776ac47a98 feat: ColorPicker icon. 2025-03-10 11:11:24 +08:00
Zhang Dian
af013bf938 feat: add AssemblyInfo. 2025-03-10 11:04:36 +08:00
Zhang Dian
2192aabf14 feat: enhance Thumb. 2025-03-10 10:54:19 +08:00
Zhang Dian
589221bf88 feat: index resources. 2025-03-09 22:19:32 +08:00
Zhang Dian
27b08caae7 misc: format ColorPicker xaml. 2025-03-07 18:53:49 +08:00
Zhang Dian
a6855ab7db feat: specify ContextMenu FontSize & FontWeight. 2025-03-07 18:14:06 +08:00
Zhang Dian
7a11884d97 Merge branch 'refs/heads/main' into typesetting
# Conflicts:
#	src/Semi.Avalonia/Controls/Calendar.axaml
#	src/Semi.Avalonia/Controls/TimePicker.axaml
2025-03-07 14:49:37 +08:00
Dong Bin
6488c42ea9 Merge pull request #553 from irihitech/various
fix various issues
2025-03-07 13:13:15 +08:00
Dong Bin
645876fe32 feat: stretch calendar header button. 2025-03-07 13:05:40 +08:00
Zhang Dian
74bd41a5c4 feat: enhance Previous & Next Button in Calendar. 2025-03-07 01:07:40 +08:00
Zhang Dian
4e48cde1e7 fix: specify Bold FontWeight to CalendarItemWeekDay. 2025-03-07 01:07:39 +08:00
Zhang Dian
90023554e8 misc: replace BorderThickness resource in TimePicker.axaml. 2025-03-07 01:07:38 +08:00
Zhang Dian
f30b2dc263 feat: adjust TopLevel MenuItem. 2025-03-07 01:07:34 +08:00
Zhang Dian
8094582911 fix: fix the Button in MenuScrollViewer Padding. 2025-03-07 01:07:33 +08:00
Zhang Dian
6dcc27acbc misc: add x:CompileBinding to AdornerLayer.axaml. 2025-03-07 01:06:33 +08:00
Zhang Dian
30f39d1383 feat: replace discrete Icon Size. 2025-03-06 23:35:31 +08:00
Zhang Dian
42233d272c feat: replace discrete CornerRadius. 2025-03-06 22:44:32 +08:00
Zhang Dian
38e4866531 feat: replace discrete FontWeight & specify DefaultFontWeight. 2025-03-06 22:16:23 +08:00
Zhang Dian
623ce798df feat: replace discrete FontSize. 2025-03-06 22:05:58 +08:00
Zhang Dian
19dcb020f1 misc: format Controls axaml. 2025-03-06 14:38:50 +08:00
Dong Bin
9081855ab1 Merge pull request #548 from snail1519/Large-label-vertical-alignment
fix: Large label vertical alignment is wrong
2025-03-06 13:13:24 +08:00
snail1519
3210269589 Rollback LabelTagLargePadding 2025-03-06 10:43:19 +08:00
snail1519
857e14368b fix last commit 2025-03-03 22:48:29 +08:00
snail1519
9ba6a22b6d fix: TagLabel Template issue 2025-03-03 22:16:34 +08:00
snail1519
251f884248 fix: Large label vertical alignment is wrong 2025-03-03 16:02:20 +08:00
Zhang Dian
37211a07e7 misc: bump version. 2025-02-28 17:22:31 +08:00
snail1519
3761a0a3fb fix: 修复ComboBox控件的PlaceholderForeground属性失效 (#543)
* fix: 修复ComboBox控件的PlaceholderForeground属性失效

* Update src/Semi.Avalonia/Themes/Dark/ComboBox.axaml

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>

* Update src/Semi.Avalonia/Controls/ComboBox.axaml

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>

* Update src/Semi.Avalonia/Themes/Light/ComboBox.axaml

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>

* add: 对比色主题添加ComboBoxSelectorPlaceHolderForeground资源

* Revert "add: 对比色主题添加ComboBoxSelectorPlaceHolderForeground资源"

This reverts commit ba526e2cf9.

* add: 对比色主题添加ComboBoxSelectorPlaceHolderForeground资源

* Update src/Semi.Avalonia/Themes/HighContrast/ComboBox.axaml

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>

---------

Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2025-02-26 10:45:24 +08:00
Zhang Dian
d906a7754c Merge pull request #542 from irihitech/scrollbar
Enhance ScrollViewer
2025-02-24 16:33:27 +08:00
Zhang Dian
d712f16642 feat: redesign ScrollViewer. 2025-02-14 23:12:27 +08:00
Dong Bin
947081302a feat: respect AllowAutoHide property. 2025-02-14 02:48:25 +08:00
Zhang Dian
28ce72dda9 feat: add Toggle SelectionMode to ListDemo. 2025-01-25 13:11:56 +08:00
Zhang Dian
78bc6c370b misc: bump version. 2025-01-24 10:46:03 +08:00
Dong Bin
2999beefac Merge pull request #540 from irihitech/variable
Unify tokens
2025-01-23 17:49:28 +08:00
Zhang Dian
77a05fb801 fix: fix AOT issue. 2025-01-23 17:39:19 +08:00
Zhang Dian
98dd72e9e3 misc: unify tokens. 2025-01-23 14:27:58 +08:00
Dong Bin
5a954fbca8 Merge pull request #539 from irihitech/variable
add Variable Demo & add copy button to PaletteDemo, HighContrastDemo
2025-01-22 18:20:34 +08:00
Zhang Dian
2da0733bdf feat: add Type column. 2025-01-22 16:29:56 +08:00
Zhang Dian
a5255bd032 feat: using DataGridCollectionView. 2025-01-22 15:54:16 +08:00
Zhang Dian
7530061ca4 misc: simplify DataGridDemoViewModel. 2025-01-22 15:54:15 +08:00
Zhang Dian
58c1c365a9 misc: revert DynamicResource Copy Button. 2025-01-21 23:50:22 +08:00
Zhang Dian
b5fe4d92a6 feat: add CopyText to HighContrastDemo. 2025-01-21 21:17:20 +08:00
Zhang Dian
5d0116ca8e feat: add DynamicResource CopyButton. 2025-01-21 20:32:37 +08:00
Zhang Dian
e981fe1c82 feat: add CopyText to PaletteDemo. 2025-01-21 20:24:21 +08:00
Zhang Dian
232ce71677 feat: add CopyText; 2025-01-21 20:18:08 +08:00
Zhang Dian
3fceec143d feat: enhance display value & add Copy button. 2025-01-21 19:36:16 +08:00
Zhang Dian
a99db733ed feat: add VariablesDemo. 2025-01-21 18:51:54 +08:00
Zhang Dian
bb928fb239 misc: simplify PaletteDemo. 2025-01-21 16:46:21 +08:00
Zhang Dian
371eb1b0d3 Merge pull request #537 from irihitech/caption
fix: fix potential issue when assigning invalid culture at runtime.
2025-01-20 20:58:20 +08:00
Zhang Dian
e56ef9d6ca misc: format codes. 2025-01-20 20:56:38 +08:00
Dong Bin
0eeba47e88 fix: fix potential issue when assigning invalid culture at runtime. 2025-01-20 18:47:41 +08:00
Dong Bin
96078a4115 Merge pull request #533 from irihitech/caption
Redesign CaptionButtons
2025-01-20 15:59:17 +08:00
Zhang Dian
26ef3ebf36 feat: specify IconButton Width & Height. 2025-01-19 23:35:50 +08:00
Dong Bin
8615783b61 Merge pull request #536 from irihitech/517
Fix actual Height
2025-01-19 17:12:12 +08:00
Zhang Dian
a0ca9fa4d0 fix: remove vertical Padding to fix the actual height of Button & Label. 2025-01-19 17:02:14 +08:00
Zhang Dian
e6ff4103ef fix: fix DatePicker Height. 2025-01-19 15:57:11 +08:00
Zhang Dian
2514d919f1 feat: redesign CaptionButtons. 2025-01-17 00:04:14 +08:00
Dong Bin
7a4b18e14a Merge pull request #530 from irihitech/high-contrast
Replace SolidColorBrush with StaticResource in high-contrast themes.
2025-01-13 17:17:38 +08:00
Zhang Dian
32e5e6b5f2 feat: replace SolidColorBrush with StaticResource in high-contrast themes. 2025-01-13 15:06:39 +08:00
Dong Bin
c253154e8f Add TrayIcon demo (#529)
* feat: add tray demo, change icon.

* feat: include favicon.
2025-01-13 12:37:55 +08:00
Dong Bin
8955c83fd9 Merge pull request #528 from irihitech/sync
Add RegisterFollowSystemTheme extension to Application
2025-01-07 15:08:11 +08:00
Zhang Dian
ea51867f0f feat: add RegisterFollowSystemTheme extension. 2025-01-07 12:45:14 +08:00
Dong Bin
8bb314984e Merge pull request #527 from irihitech/sync
Sync high-contrast themes under the Windows OS.
2025-01-06 22:37:00 +08:00
Zhang Dian
af6c52660d feat: sync high-contrast themes under the Windows OS. 2025-01-06 22:14:06 +08:00
Ruben
f6962657fa add german language support (#526)
added german culture support
2025-01-06 22:10:12 +08:00
Dong Bin
8df91270b1 Merge pull request #525 from irihitech/iconbutton
Enhance Icon related Button in demo
2025-01-04 20:34:54 +08:00
Zhang Dian
22f61cd836 fix: fix Menu RepeatButton MaxHeight value. 2025-01-04 12:49:10 +08:00
Zhang Dian
86848b548f feat: enhance Icon related Button in demo. 2025-01-04 12:48:45 +08:00
Zhang Dian
67fd0c4ca3 Merge pull request #520 from irihitech/locale
Add locale switch helper method
2025-01-03 17:18:43 +08:00
Dong Bin
263c65dd18 feat: simplify menu. 2025-01-03 15:51:51 +08:00
Dong Bin
26bb251d1e misc: reduce menu level. 2025-01-03 15:34:38 +08:00
Dong Bin
609dfbb5f0 feat: add simple locale switch. 2025-01-03 15:19:32 +08:00
Dong Bin
ad4bead1bd feat: add helper method to set locale resources. 2025-01-03 15:02:26 +08:00
Dong Bin
02444f7f16 Merge pull request #519 from irihitech/token
add `Variables` tokens and replace resources with them
2025-01-02 18:44:40 +08:00
Zhang Dian
06d9e35add misc: delete Base.axaml file. 2025-01-02 17:44:28 +08:00
Zhang Dian
1200c9a1c9 feat: index RadiusCardCornerRadius. 2025-01-02 16:58:12 +08:00
Zhang Dian
7600b187f4 feat: replace most resources in Shared folder with basic design tokens. 2025-01-02 14:31:47 +08:00
Zhang Dian
c55efe8835 misc: format shared codes. 2025-01-02 14:18:43 +08:00
Zhang Dian
1fe4df3716 feat: add basic Variables. 2025-01-02 14:18:43 +08:00
Zhang Dian
c22211df24 misc: using single-commit mode for gh-pages branch. 2025-01-01 16:39:24 +08:00
Zhang Dian
6459863395 misc: bump version. 2024-12-31 14:18:23 +08:00
Dong Bin
ab824fbcd2 Merge pull request #516 from irihitech/detail
fix Hex Color code in demo
2024-12-31 14:09:16 +08:00
Zhang Dian
e4adde26d2 fix: fix AOT issue. 2024-12-31 13:59:30 +08:00
Zhang Dian
057c31a311 feat: Color.ToString() -> real Hex. 2024-12-31 13:22:06 +08:00
Zhang Dian
ef8531d25d misc: rearrange demo theme resources. 2024-12-31 13:22:05 +08:00
Zhang Dian
c44b9a0173 fix: fix debug crash issue. 2024-12-31 13:22:05 +08:00
Zhang Dian
5715bba345 fix: add the missing basic color. 2024-12-31 13:21:30 +08:00
Zhang Dian
96b0999db1 fix: fix AOT issue. 2024-12-30 23:54:15 +08:00
Zhang Dian
ffd9b08acc fix: fix the issue of input value invalid. 2024-12-30 16:50:59 +08:00
Zhang Dian
64fd8a787a misc: enhance .csproj files. 2024-12-30 16:19:30 +08:00
Zhang Dian
4087b685e8 misc: resolve IDE problems. 2024-12-30 15:16:14 +08:00
Zhang Dian
70669406b2 misc: fix missing reference issue. 2024-12-30 14:06:19 +08:00
228 changed files with 2697 additions and 2301 deletions

15
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: semiavalonia
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -36,6 +36,7 @@ jobs:
- name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: ${{ env.OUTPUT_PATH }}
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: ${{ env.OUTPUT_PATH }}
single-commit: true

View File

@@ -21,7 +21,7 @@ on:
Semi_Avalonia_DataGrid:
description: 'Pack Semi.Avalonia.DataGrid'
required: true
default: 'true'
default: 'false'
type: boolean
Semi_Avalonia_TreeDataGrid:
description: 'Pack Semi.Avalonia.TreeDataGrid'

View File

@@ -16,7 +16,7 @@ on:
Semi_Avalonia_DataGrid:
description: 'Pack Semi.Avalonia.DataGrid'
required: true
default: 'true'
default: 'false'
type: boolean
Semi_Avalonia_TreeDataGrid:
description: 'Pack Semi.Avalonia.TreeDataGrid'

View File

@@ -44,17 +44,17 @@ jobs:
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip
- name: Enable Native AOT in .csproj
if: ${{ github.event.inputs.include_aot == true }}
if: ${{ github.event.inputs.include_aot == 'true' }}
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
if: ${{ github.event.inputs.include_aot == true }}
if: ${{ github.event.inputs.include_aot == 'true' }}
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
- name: Zip win-x64 AOT
if: ${{ github.event.inputs.include_aot == true }}
if: ${{ github.event.inputs.include_aot == 'true' }}
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
@@ -82,11 +82,11 @@ jobs:
run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
- name: Publish linux-x64 DRM
if: ${{ github.event.inputs.include_drm == true }}
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
- name: Zip linux-x64 DRM
if: ${{ github.event.inputs.include_drm == true }}
if: ${{ github.event.inputs.include_drm == 'true' }}
run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb"
- name: Upload a Build Artifact

View File

@@ -20,9 +20,6 @@ jobs:
- 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:

View File

@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.2.2</AvaloniaVersion>
<CommunityToolkitVersion>8.3.2</CommunityToolkitVersion>
</PropertyGroup>
<PropertyGroup>
<AvaloniaVersion>11.2.5</AvaloniaVersion>
<DataGridVersion>11.2.5</DataGridVersion>
<CommunityToolkitVersion>8.4.0</CommunityToolkitVersion>
</PropertyGroup>
</Project>

View File

@@ -1,13 +1,11 @@
using Avalonia;
using System;
using Avalonia;
using Avalonia.Dialogs;
using Avalonia.Media;
using System;
using System.Linq;
using System.Threading;
namespace Semi.Avalonia.Demo.Desktop;
class Program
sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
@@ -33,4 +31,4 @@ class Program
.UsePlatformDetect()
.With(new Win32PlatformOptions())
.LogToTrace();
}
}

View File

@@ -19,16 +19,14 @@
</PropertyGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
<TrimmerRootDescriptor Include="Roots.xml"/>
</ItemGroup>
<ItemGroup>
<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)" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
</ItemGroup>
</Project>

View File

@@ -7,7 +7,7 @@ using Avalonia.Dialogs;
namespace Semi.Avalonia.Demo.Drm;
class Program
sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized

View File

@@ -19,17 +19,15 @@
</PropertyGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
<TrimmerRootDescriptor Include="Roots.xml"/>
</ItemGroup>
<ItemGroup>
<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)" />
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
</ItemGroup>
</Project>

View File

@@ -3,6 +3,7 @@
<TargetFramework>net8.0-browser</TargetFramework>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View File

@@ -6,6 +6,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./app.css" />
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<body style="margin: 0; overflow: hidden">

View File

@@ -2,13 +2,35 @@
x:Class="Semi.Avalonia.Demo.App"
xmlns="https://github.com/avaloniaui"
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>
<!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-CN" />
<semi:SemiPopupAnimations/>
<semi:SemiPopupAnimations />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</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>

View File

@@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Semi.Avalonia.Demo.ViewModels;
using Semi.Avalonia.Demo.Views;
namespace Semi.Avalonia.Demo;
@@ -11,6 +12,7 @@ public partial class App : Application
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
this.DataContext = new ApplicationViewModel();
}
public override void OnFrameworkInitializationCompleted()
@@ -28,6 +30,7 @@ public partial class App : Application
break;
}
this.RegisterFollowSystemTheme();
base.OnFrameworkInitializationCompleted();
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

View 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"),
};
}

View File

@@ -1,8 +1,10 @@
using System.Globalization;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Media;
using Semi.Avalonia.Demo.Converters;
namespace Semi.Avalonia.Demo.Controls;
@@ -10,6 +12,7 @@ public class ColorDetailControl : TemplatedControl
{
public const string KEY_ResourceKey = "ResourceKey";
public const string KEY_Hex = "Hex";
public const string KEY_Hex2 = "Hex2";
public const string KEY_Opacity = "Opacity";
public const string KEY_ColorResourceKey = "ColorResourceKey";
@@ -51,6 +54,17 @@ public class ColorDetailControl : TemplatedControl
private set => SetAndRaise(HexProperty, ref _hex, value);
}
private string? _hex2;
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);
@@ -70,34 +84,30 @@ public class ColorDetailControl : TemplatedControl
private void OnBackgroundChanged(AvaloniaPropertyChangedEventArgs args)
{
var color = args.GetNewValue<IBrush>();
if (color is ISolidColorBrush b)
if (color is ISolidColorBrush brush)
{
Hex = b.Color.ToString().ToUpperInvariant();
OpacityNumber = b.Opacity.ToString(CultureInfo.InvariantCulture);
var hex1 = ColorConverter.ToHex.Convert(brush.Color, typeof(string), false, 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;
if (o is string s)
{
switch (s)
text = s switch
{
case KEY_ResourceKey:
text = ResourceKey;
break;
case KEY_Hex:
text = Hex;
break;
case KEY_Opacity:
text = OpacityNumber;
break;
case KEY_ColorResourceKey:
text = ColorResourceKey;
break;
default: text = string.Empty; break;
}
KEY_ResourceKey => ResourceKey,
KEY_Hex => Hex,
KEY_Hex2 => Hex2,
KEY_Opacity => OpacityNumber,
KEY_ColorResourceKey => ColorResourceKey,
_ => string.Empty
};
}
var toplevel = TopLevel.GetTopLevel(this);

View 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
}
);
}

View File

@@ -2,8 +2,7 @@
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:colorPicker="clr-namespace:Semi.Avalonia.ColorPicker;assembly=Semi.Avalonia.ColorPicker"
xmlns:controls="using:Avalonia.Controls"
xmlns:semi="https://irihi.tech/semi"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="1450"
@@ -11,18 +10,15 @@
mc:Ignorable="d">
<ScrollViewer>
<StackPanel Spacing="20">
<StackPanel
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="20">
<StackPanel Orientation="Horizontal" Spacing="20">
<ColorView Name="Test" ColorSpectrumShape="Ring" />
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel>
<StackPanel VerticalAlignment="Top" Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<ColorView
Name="SimpleColorViewTest"
HsvColor="hsv(120,11%,10%)"
HsvColor="hsv(180,80%,70%)"
IsAlphaVisible="True"
Theme="{StaticResource SimpleColorView}" />
<StackPanel>
@@ -30,63 +26,55 @@
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
</StackPanel>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker Margin="8" ColorSpectrumShape="Ring">
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker ColorSpectrumShape="Ring">
<ColorPicker.Palette>
<controls:FlatHalfColorPalette />
<FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker Margin="8" ColorSpectrumShape="Box">
<ColorPicker ColorSpectrumShape="Box">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker
Margin="8"
ColorSpectrumShape="Box"
Theme="{DynamicResource HexColorPicker}">
Theme="{DynamicResource HexColorPicker}"
ColorSpectrumShape="Box">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left" >
<TextBlock Text="Use Style to customize button"></TextBlock>
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="Use Style to customize button" />
<ColorPicker
Margin="8"
Width="32"
HsvColor="hsv(120,11%,10%)"
>
MinWidth="32"
HsvColor="hsv(180,80%,70%)">
<ColorPicker.Content>
<Border
Margin="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{Binding $parent[ColorPicker].HsvColor,
Converter={StaticResource ToBrushConverter}}"
Background="{Binding $parent[ColorPicker].HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="1" />
</ColorPicker.Content>
<ColorPicker.Styles>
<Style Selector="DropDownButton">
<Setter Property="Padding" Value="0"/>
<Setter Property="Padding" Value="0" />
<Style Selector="^ /template/ PathIcon">
<Setter Property="IsVisible" Value="False"/>
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
</ColorPicker.Styles>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker
Margin="8"
HsvColor="hsv(120,11%,10%)"
Theme="{StaticResource SimpleColorPicker}" />
Theme="{StaticResource SimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
<ColorPicker
Margin="8"
HsvColor="hsv(120,11%,10%)"
Theme="{StaticResource HexSimpleColorPicker}" />
Theme="{StaticResource HexSimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
</StackPanel>
</StackPanel>
</ScrollViewer>

View File

@@ -3,7 +3,6 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Semi.Avalonia.Demo.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo"
d:DesignHeight="450"
@@ -15,8 +14,9 @@
<TabItem Header="DataGrid">
<Grid RowDefinitions="Auto, *">
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Disable" Name="DisableToggle" />
<ToggleSwitch Content="ScrollViewerHide" Name="ScrollViewerHide" />
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
<ToggleSwitch Content="Inset Content" Name="inset" />
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
</StackPanel>
<DataGrid Grid.Row="1"
Margin="8"
@@ -25,8 +25,9 @@
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ScrollViewer.AllowAutoHide="{Binding #ScrollViewerHide.IsChecked}"
IsEnabled="{Binding #DisableToggle.IsChecked}"
Classes.InsetContent="{Binding #inset.IsChecked}"
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
IsEnabled="{Binding #enable.IsChecked}"
ItemsSource="{Binding GridData1}">
<DataGrid.Columns>
<DataGridTextColumn

View File

@@ -4,21 +4,15 @@
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>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="../Themes/ToggleSwitch.axaml" />
<ResourceInclude Source="../Controls/ColorItemControl.axaml" />
<ResourceInclude Source="../Controls/ColorDetailControl.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<SplitView
Name="splitView"
CompactPaneLength="50"
@@ -32,7 +26,8 @@
Name="toggle"
HorizontalAlignment="Right"
IsChecked="True"
Theme="{DynamicResource SplitViewToggleSwitch}" />
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}" />
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
<Panel>
<TextBlock
@@ -285,7 +280,8 @@
<SelectableTextBlock
Margin="12 0"
VerticalAlignment="Center"
Text="{Binding Hex}" />
Text="{Binding Brush,
Converter={x:Static cvt:ColorConverter.ToHex},ConverterParameter={x:False}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@@ -311,6 +307,18 @@
</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>

View File

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

View File

@@ -119,11 +119,11 @@
<StackPanel Spacing="20">
<TextBlock Text="Theme: CheckGroupListBox"/>
<ListBox
SelectionMode="Multiple"
SelectionMode="Multiple,Toggle"
Theme="{DynamicResource CheckGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
<ListBox Theme="{DynamicResource CheckGroupListBox}"
SelectionMode="Multiple"
SelectionMode="Multiple,Toggle"
IsEnabled="False">
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
<ListBoxItem>WPF</ListBoxItem>
@@ -131,11 +131,11 @@
<TextBlock Text="Theme: CardCheckGroupListBox"/>
<ListBox
SelectionMode="Multiple"
SelectionMode="Multiple,Toggle"
Theme="{DynamicResource CardCheckGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
<ListBox Theme="{DynamicResource CardCheckGroupListBox}"
SelectionMode="Multiple"
SelectionMode="Multiple,Toggle"
IsEnabled="False">
<ListBoxItem>Avalonia</ListBoxItem>
<ListBoxItem IsSelected="True">WPF</ListBoxItem>

View File

@@ -41,9 +41,9 @@
<Image.Source>
<DrawingImage>
<DrawingGroup>
<GeometryDrawing Brush="#8B44AC" Geometry="M74.8535 85.8231C75.0263 85.8231 75.1954 85.8231 75.3679 85.8231C80.7347 85.8231 85.1439 81.8027 85.7614 76.6019L85.8357 41.7604C85.2255 18.5931 66.2537 0 42.9393 0C19.2399 0 0.02771 19.2122 0.02771 42.9116C0.02771 66.3573 18.8309 85.418 42.18 85.8231H74.8535Z" />
<GeometryDrawing Brush="#F9F9FB" Geometry="M43.0585 14.6143C29.5513 14.6143 18.2555 24.082 15.4454 36.7432C18.1357 37.4975 20.1087 39.9679 20.1087 42.8992C20.1087 45.8305 18.1357 48.301 15.4454 49.0552C18.2555 61.7164 29.5513 71.1842 43.0585 71.1842C47.9754 71.1842 52.5993 69.9296 56.6276 67.723V70.9926H71.3435V44.0716C71.3569 43.7138 71.3435 43.2603 71.3435 42.8992C71.3435 27.2779 58.6799 14.6143 43.0585 14.6143ZM29.5096 42.8992C29.5096 35.4164 35.5757 29.3503 43.0585 29.3503C50.5414 29.3503 56.6074 35.4164 56.6074 42.8992C56.6074 50.3821 50.5414 56.4481 43.0585 56.4481C35.5757 56.4481 29.5096 50.3821 29.5096 42.8992Z" />
<GeometryDrawing Brush="#F9F9FB" Geometry="M18.105 42.8805C18.105 45.3803 16.0785 47.4068 13.5787 47.4068C11.0789 47.4068 9.05237 45.3803 9.05237 42.8805C9.05237 40.3807 11.0789 38.3542 13.5787 38.3542C16.0785 38.3542 18.105 40.3807 18.105 42.8805Z" />
<GeometryDrawing Brush="#0D6EFD" Geometry="M74.8535 85.8231C75.0263 85.8231 75.1954 85.8231 75.3679 85.8231C80.7347 85.8231 85.1439 81.8027 85.7614 76.6019L85.8357 41.7604C85.2255 18.5931 66.2537 0 42.9393 0C19.2399 0 0.02771 19.2122 0.02771 42.9116C0.02771 66.3573 18.8309 85.418 42.18 85.8231H74.8535Z" />
<GeometryDrawing Brush="White" Geometry="M43.0585 14.6143C29.5513 14.6143 18.2555 24.082 15.4454 36.7432C18.1357 37.4975 20.1087 39.9679 20.1087 42.8992C20.1087 45.8305 18.1357 48.301 15.4454 49.0552C18.2555 61.7164 29.5513 71.1842 43.0585 71.1842C47.9754 71.1842 52.5993 69.9296 56.6276 67.723V70.9926H71.3435V44.0716C71.3569 43.7138 71.3435 43.2603 71.3435 42.8992C71.3435 27.2779 58.6799 14.6143 43.0585 14.6143ZM29.5096 42.8992C29.5096 35.4164 35.5757 29.3503 43.0585 29.3503C50.5414 29.3503 56.6074 35.4164 56.6074 42.8992C56.6074 50.3821 50.5414 56.4481 43.0585 56.4481C35.5757 56.4481 29.5096 50.3821 29.5096 42.8992Z" />
<GeometryDrawing Brush="White" Geometry="M18.105 42.8805C18.105 45.3803 16.0785 47.4068 13.5787 47.4068C11.0789 47.4068 9.05237 45.3803 9.05237 42.8805C9.05237 40.3807 11.0789 38.3542 13.5787 38.3542C16.0785 38.3542 18.105 40.3807 18.105 42.8805Z" />
</DrawingGroup>
</DrawingImage>
</Image.Source>
@@ -234,7 +234,7 @@
VerticalAlignment="Top"
Palette="{DynamicResource SemiColorPalette}"
SelectedIndex="2"
Color="#8B44AC" />
Color="#0D6EFD" />
<StackPanel Width="300" Margin="8">
<StackPanel Orientation="Horizontal">
<Slider

View File

@@ -9,18 +9,18 @@ public partial class Overview : UserControl
InitializeComponent();
}
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.2.1.2";
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.2.1.6";
public string MainStyle { get; set; } =
"""
<Application.Styles>
<!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" />
<!-- <StyleInclude Source="avares://Semi.Avalonia/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-CN" />
</Application.Styles>
""";
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.2.1.2";
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.2.1.6";
public string ColorPickerStyle { get; set; } =
"""
@@ -29,7 +29,7 @@ public partial class Overview : UserControl
</Application.Styles>
""";
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.2.1.2";
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.2.1.6";
public string DataGridStyle { get; set; } =
"""
@@ -38,7 +38,7 @@ public partial class Overview : UserControl
</Application.Styles>
""";
public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.10.1";
public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.10.2";
public string TreeDataGridStyle { get; set; } =
"""

View File

@@ -14,17 +14,6 @@
<Design.DataContext>
<viewModels:PaletteDemoViewModel />
</Design.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="../Themes/ToggleSwitch.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
Name="splitView"
CompactPaneLength="50"
@@ -38,7 +27,8 @@
Name="toggle"
HorizontalAlignment="Right"
IsChecked="True"
Theme="{DynamicResource SplitViewToggleSwitch}" />
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}" />
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
<Panel>
<TextBlock

View File

@@ -1,8 +1,6 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using Semi.Avalonia.Demo.ViewModels;
@@ -16,13 +14,20 @@ public partial class PaletteDemo : UserControl
this.DataContext = new PaletteDemoViewModel();
}
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
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());
}
}
}

View File

@@ -9,66 +9,22 @@
mc:Ignorable="d">
<ScrollViewer>
<StackPanel HorizontalAlignment="Left" Spacing="20">
<ToggleSwitch Name="inset" Content="Inset Content" />
<ToggleSwitch Name="autohide" Content="Allow AutoHide" />
<ScrollViewer
Width="200"
Height="200"
Margin="10"
Width="200" Height="200"
AllowAutoHide="{Binding #autohide.IsChecked}"
Classes.InsetContent="{Binding #inset.IsChecked}"
HorizontalScrollBarVisibility="Auto">
<Grid RowDefinitions="Auto,Auto"
ColumnDefinitions="Auto,Auto"
Width="300" Height="300">
<Rectangle
Grid.Row="0" Grid.Column="0"
Width="150"
Height="150"
Fill="{DynamicResource SemiYellow2}" />
<Rectangle
Grid.Row="0" Grid.Column="1"
Width="150"
Height="150"
Fill="{DynamicResource SemiBlue2}" />
<Rectangle
Grid.Row="1" Grid.Column="0"
Width="150"
Height="150"
Fill="{DynamicResource SemiPink2}" />
<Rectangle
Grid.Row="1" Grid.Column="1"
Width="150"
Height="150"
Fill="{DynamicResource SemiGreen2}" />
</Grid>
</ScrollViewer>
<ScrollViewer
Width="200"
Height="200"
Margin="10"
HorizontalScrollBarVisibility="Auto"
Theme="{DynamicResource StaticScrollViewer}">
<Grid RowDefinitions="Auto,Auto"
ColumnDefinitions="Auto,Auto"
Width="300" Height="300">
<Rectangle
Grid.Row="0" Grid.Column="0"
Width="150"
Height="150"
Fill="{DynamicResource SemiYellow2}" />
<Rectangle
Grid.Row="0" Grid.Column="1"
Width="150"
Height="150"
Fill="{DynamicResource SemiBlue2}" />
<Rectangle
Grid.Row="1" Grid.Column="0"
Width="150"
Height="150"
Fill="{DynamicResource SemiPink2}" />
<Rectangle
Grid.Row="1" Grid.Column="1"
Width="150"
Height="150"
Fill="{DynamicResource SemiGreen2}" />
</Grid>
<UniformGrid
Rows="2" Columns="2"
Width="300" Height="300">
<Rectangle Fill="{DynamicResource SemiYellow2}" />
<Rectangle Fill="{DynamicResource SemiBlue2}" />
<Rectangle Fill="{DynamicResource SemiPink2}" />
<Rectangle Fill="{DynamicResource SemiGreen2}" />
</UniformGrid>
</ScrollViewer>
</StackPanel>
</ScrollViewer>

View File

@@ -109,7 +109,8 @@
ItemsSource="{Binding Songs}" />
<ToggleSwitch
Grid.Row="2"
Theme="{DynamicResource SplitViewToggleSwitch}"
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}"
HorizontalAlignment="Left"
IsChecked="{Binding #SplitView.IsPaneOpen}">
</ToggleSwitch>

View File

@@ -20,7 +20,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" />
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsChecked="True"/>
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsChecked="True" />
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsEnabled="False" />
<ToggleSwitch Content="Switch" OnContent="Yes" OffContent="No" IsEnabled="False" IsChecked="True" />
</StackPanel>
@@ -64,7 +64,9 @@
<StackPanel Orientation="Horizontal">
<ToggleSwitch
HorizontalAlignment="Left"
Padding="8"
Padding="{StaticResource SemiThicknessTight}"
Width="{StaticResource SemiSpacingExtraLoose}"
Height="{StaticResource SemiSpacingExtraLoose}"
Theme="{DynamicResource ButtonToggleSwitch}"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}">
<ToggleSwitch.Content>
@@ -75,7 +77,9 @@
</ToggleSwitch>
<ToggleSwitch
HorizontalAlignment="Left"
Padding="8"
Padding="{StaticResource SemiThicknessTight}"
Width="{StaticResource SemiSpacingExtraLoose}"
Height="{StaticResource SemiSpacingExtraLoose}"
Theme="{DynamicResource ButtonToggleSwitch}"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}">
<ToggleSwitch.OnContent>

View File

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

View File

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

View File

@@ -4,22 +4,26 @@
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<!--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="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)" />
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)"/>
</ItemGroup>
<ItemGroup>
<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\Semi.Avalonia.csproj" />
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>
</ItemGroup>
</Project>

View File

@@ -1,7 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls">
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
x:CompileBindings="True">
<ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl">
<Setter Property="Template">
<ControlTemplate TargetType="controls:ColorDetailControl">
@@ -16,7 +17,7 @@
HorizontalAlignment="Stretch"
Background="{TemplateBinding Background}"
CornerRadius="6" />
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *, *, *, *, *">
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *, *, *, *, *, *">
<!-- Row 0-1-2 ResourceKey -->
<TextBlock
Grid.Column="0"
@@ -33,38 +34,26 @@
<Button
Grid.Row="1"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ResourceKey}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
<SelectableTextBlock
Grid.Row="2"
Grid.Column="0"
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}" />
<Button
Grid.Row="2"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ColorResourceKey}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
IsVisible="{TemplateBinding ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
<!-- Row 3-4 HEX -->
<!-- Row 3-4-5 HEX -->
<TextBlock
Grid.Row="3"
Grid.Column="0"
@@ -72,7 +61,7 @@
Margin="4,8,0,0"
VerticalAlignment="Center"
Classes="Tertiary"
Text="ARGB" />
Text="Hex" />
<SelectableTextBlock
Grid.Row="4"
Grid.Column="0"
@@ -81,47 +70,48 @@
<Button
Grid.Row="4"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Hex}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<!-- Row 5-6 Opacity -->
<TextBlock
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
<SelectableTextBlock
Grid.Row="5"
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"
Margin="4,8,0,0"
VerticalAlignment="Center"
Classes="Tertiary"
Text="Opacity" />
<SelectableTextBlock
Grid.Row="6"
Grid.Row="7"
Grid.Column="0"
VerticalAlignment="Center"
Text="{TemplateBinding OpacityNumber}" />
<Button
Grid.Row="6"
Grid.Row="7"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Opacity}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</Grid>
</StackPanel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,7 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Semi.Avalonia.Demo.Controls">
xmlns:controls="using:Semi.Avalonia.Demo.Controls"
x:CompileBindings="True">
<Design.PreviewWith>
<controls:ColorItemControl />
</Design.PreviewWith>

View File

@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
x:CompileBindings="True"
x:DataType="viewModels:FunctionalColorGroupViewModel">
<ControlTheme x:Key="{x:Type controls:FunctionalColorGroupControl}" TargetType="controls:FunctionalColorGroupControl">
@@ -30,27 +31,21 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="ResourceKey">
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Name" />
<DataGridTemplateColumn Width="100" Header="Hex">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Hex}" />
</DataTemplate>
@@ -60,13 +55,29 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
HorizontalAlignment="Right"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Brush.Opacity}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>
@@ -84,27 +95,21 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="ResourceKey">
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Name" />
<DataGridTemplateColumn Width="100" Header="Hex">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Hex}" />
</DataTemplate>
@@ -114,13 +119,29 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
HorizontalAlignment="Right"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding Brush.Opacity}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ColorItemViewModel"
Binding="{Binding ColorDisplayName}"
CanUserSort="False"
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ColorItemViewModel">
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</TabItem>

View File

@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
x:CompileBindings="True"
x:DataType="viewModels:ShadowGroupViewModel">
<ControlTheme x:Key="{x:Type controls:ShadowGroupControl}" TargetType="controls:ShadowGroupControl">
@@ -19,29 +20,40 @@
<TabItem Header="Light">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightShadows}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*" Header="ResourceKey">
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="BoxShadows">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ShadowItemViewModel"
Binding="{Binding ShadowDisplayName}"
CanUserSort="False"
Header="Name" />
<DataGridTemplateColumn Width="300" Header="BoxShadows">
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@@ -51,29 +63,40 @@
<TabItem Header="Dark">
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkShadows}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*" Header="ResourceKey">
<DataGridTemplateColumn Width="300" Header="ResourceKey">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding ResourceKey}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300" Header="BoxShadows">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="*"
x:DataType="viewModels:ShadowItemViewModel"
Binding="{Binding ShadowDisplayName}"
CanUserSort="False"
Header="Name" />
<DataGridTemplateColumn Width="300" Header="BoxShadows">
Header="Description" />
<DataGridTemplateColumn Width="100" Header="CopyText">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="viewModels:ShadowItemViewModel">
<SelectableTextBlock
Margin="12,0,12,0"
VerticalAlignment="Center"
Text="{Binding BoxShadowValue}" />
<Button
Command="{Binding $parent[pages:PaletteDemo].Copy}"
CommandParameter="{Binding CopyText}"
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconCopy}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

View File

@@ -1,31 +1,46 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="ThemeToggleSwitch"
<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="8" />
<Setter Property="OnContent" Value="{Binding $self.Content}" />
<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">
<DataTemplate>
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
</DataTemplate>
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
<Setter Property="OffContent" Value="{Binding $self.Content}" />
<Setter Property="OffContentTemplate">
<DataTemplate>
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
</DataTemplate>
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
<Setter Property="ContentTemplate">
<DataTemplate>
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
</DataTemplate>
<StaticResource ResourceKey="GeometryDataTemplate" />
</Setter>
</ControlTheme>
<ControlTheme x:Key="SplitViewToggleSwitch"
BasedOn="{StaticResource ThemeToggleSwitch}"
TargetType="ToggleSwitch">
<Setter Property="Content"
Value="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" />
<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>

View 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>

View 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();
}
}
}

View File

@@ -8,14 +8,14 @@ using CommunityToolkit.Mvvm.Input;
namespace Semi.Avalonia.Demo.ViewModels;
public class DataGridDemoViewModel: ObservableObject
public class DataGridDemoViewModel : ObservableObject
{
public ObservableCollection<Song> GridData1 { get; set; }
public DataGridCollectionView GridData2 { get; set; }
public ObservableCollection<SongViewModel> GridData3 { get; set; }
public RelayCommand AddCommand { get; set; }
public DataGridDemoViewModel()
@@ -23,7 +23,7 @@ public class DataGridDemoViewModel: ObservableObject
GridData1 = new ObservableCollection<Song>(Song.Songs);
GridData2 = new DataGridCollectionView(Song.Songs);
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a=>new SongViewModel()
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a => new SongViewModel()
{
Title = a.Title,
Artist = a.Artist,
@@ -57,11 +57,10 @@ public class Song
Album = album;
CountOfComment = countOfComment;
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("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
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("加州梦境", "熊猫堂ProducePandas", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775),
};
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775)
];
}
public class SongViewModel: ObservableObject
public partial class SongViewModel : ObservableObject
{
private string? _title;
private string? _artist;
private string? _album;
private int _countOfComment;
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);
}
[ObservableProperty] private string? _title;
[ObservableProperty] private string? _artist;
[ObservableProperty] private string? _album;
[ObservableProperty] private int _countOfComment;
[ObservableProperty] private bool? _isSelected;
}

View File

@@ -31,67 +31,59 @@ public partial class HighContrastDemoViewModel : ObservableObject
[
new ColorResource
{
ResourceKey = "WindowColor",
ResourceKey = "SemiColorWindow",
Brush = new SolidColorBrush(Color.Parse("#202020")),
Hex = "#FF202020",
Description = "Background of pages, panes, popups, and windows.",
PairWith = "WindowTextColor"
},
new ColorResource
{
ResourceKey = "WindowTextColor",
ResourceKey = "SemiColorWindowText",
Brush = new SolidColorBrush(Color.Parse("#FFFFFF")),
Hex = "WHITE",
Description = "Headings, body copy, lists, placeholder text, app and window borders.",
PairWith = "WindowColor"
},
new ColorResource
{
ResourceKey = "HotlightColor",
ResourceKey = "SemiColorHotlight",
Brush = new SolidColorBrush(Color.Parse("#75E9FC")),
Hex = "#FF75E9FC",
Description = "Hyperlinks.",
PairWith = "WindowColor"
},
new ColorResource
{
ResourceKey = "GrayTextColor",
ResourceKey = "SemiColorGrayText",
Brush = new SolidColorBrush(Color.Parse("#A6A6A6")),
Hex = "#FFA6A6A6",
Description = "Inactive (disabled) UI.",
PairWith = "WindowColor"
},
new ColorResource
{
ResourceKey = "HighlightTextColor",
ResourceKey = "SemiColorHighlightText",
Brush = new SolidColorBrush(Color.Parse("#263B50")),
Hex = "#FF263B50",
Description =
"Foreground color for text or UI that is in selected, interacted with (hover, pressed), or in progress.",
PairWith = "HighlightColor"
},
new ColorResource
{
ResourceKey = "HighlightColor",
ResourceKey = "SemiColorHighlight",
Brush = new SolidColorBrush(Color.Parse("#8EE3F0")),
Hex = "#FF8EE3F0",
Description =
"Background or accent color for UI that is in selected, interacted with (hover, pressed), or in progress.",
PairWith = "HighlightTextColor"
},
new ColorResource
{
ResourceKey = "ButtonTextColor",
ResourceKey = "SemiColorButtonText",
Brush = new SolidColorBrush(Color.Parse("#FFFFFF")),
Hex = "WHITE",
Description = "Foreground color for buttons and any UI that can be interacted with.",
PairWith = "ButtonFaceColor"
},
new ColorResource
{
ResourceKey = "ButtonFaceColor",
ResourceKey = "SemiColorButtonFace",
Brush = new SolidColorBrush(Color.Parse("#202020")),
Hex = "#FF202020",
Description = "Background color for buttons and any UI that can be interacted with.",
PairWith = "ButtonTextColor"
},
@@ -108,10 +100,10 @@ public partial class HighContrastDemoViewModel : ObservableObject
foreach (var colorResource in ColorResources)
{
if (colorResource.ResourceKey is null) continue;
if (topLevel?.TryFindResource(colorResource.ResourceKey, value, out var o) == true && o is Color color)
if (topLevel?.TryFindResource(colorResource.ResourceKey, value, out var o) == true
&& o is ISolidColorBrush color)
{
colorResource.Brush = new SolidColorBrush(color);
colorResource.Hex = color.ToString().ToUpperInvariant();
colorResource.Brush = color;
}
}
}
@@ -130,8 +122,12 @@ public partial class HighContrastDemoViewModel : ObservableObject
public partial class ColorResource : ObservableObject
{
[ObservableProperty] private string? _resourceKey;
[ObservableProperty] private SolidColorBrush? _brush;
[ObservableProperty] private string? _hex;
[ObservableProperty] private ISolidColorBrush? _brush;
[ObservableProperty] private string? _description;
[ObservableProperty] private string? _pairWith;
public string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
}

View File

@@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Semi.Avalonia.Demo.Constant;
using Semi.Avalonia.Demo.Converters;
using Semi.Avalonia.Tokens.Palette;
namespace Semi.Avalonia.Demo.ViewModels;
public class PaletteDemoViewModel : ObservableObject
public partial class PaletteDemoViewModel : ObservableObject
{
private readonly string[] _predefinedColorNames =
[
@@ -22,31 +25,10 @@ public class PaletteDemoViewModel : ObservableObject
private readonly IResourceDictionary? _lightResourceDictionary;
private readonly IResourceDictionary? _darkResourceDictionary;
private ColorItemViewModel _selectedColor = null!;
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);
}
[ObservableProperty] private ColorItemViewModel? _selectedColor;
public ObservableCollection<ColorListViewModel> LightLists { get; set; } = [];
public ObservableCollection<ColorListViewModel> DarkLists { get; set; } = [];
public ObservableCollection<FunctionalColorGroupViewModel> FunctionalColors { get; set; } = [];
public ObservableCollection<ShadowGroupViewModel> Shadows { get; set; } = [];
@@ -54,7 +36,7 @@ public class PaletteDemoViewModel : ObservableObject
{
_lightResourceDictionary = new Light();
_darkResourceDictionary = new Dark();
WeakReferenceMessenger.Default.Register<PaletteDemoViewModel, ColorItemViewModel>(this, OnClickColorItem);
WeakReferenceMessenger.Default.Register<ColorItemViewModel>(this, (_, item) => SelectedColor = item);
}
public void InitializeResources()
@@ -66,7 +48,6 @@ public class PaletteDemoViewModel : ObservableObject
private void InitializePalette()
{
LightLists = [];
foreach (var color in _predefinedColorNames)
{
ColorListViewModel s = new ColorListViewModel();
@@ -74,7 +55,6 @@ public class PaletteDemoViewModel : ObservableObject
LightLists.Add(s);
}
DarkLists = [];
foreach (var color in _predefinedColorNames)
{
ColorListViewModel s = new ColorListViewModel();
@@ -85,126 +65,82 @@ public class PaletteDemoViewModel : ObservableObject
private void InitializeFunctionalColors()
{
FunctionalColors.Add(new FunctionalColorGroupViewModel("Primary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.PrimaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel("Secondary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SecondaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel("Tertiary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TertiaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel("Information", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.InformationTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel("Success", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SuccessTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel("Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens));
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(
"Primary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.PrimaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Secondary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SecondaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Tertiary", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.TertiaryTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Information", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.InformationTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Success", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.SuccessTokens));
FunctionalColors.Add(new FunctionalColorGroupViewModel(
"Warning", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.WarningTokens));
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()
{
Shadows.Add(new ShadowGroupViewModel("Shadow", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.ShadowTokens));
}
private void OnClickColorItem(PaletteDemoViewModel vm, ColorItemViewModel item)
{
SelectedColor = item;
Shadows.Add(new ShadowGroupViewModel(
"Shadow", _lightResourceDictionary, _darkResourceDictionary, ColorTokens.ShadowTokens));
}
}
public class ColorListViewModel : ObservableObject
public partial class ColorListViewModel : ObservableObject
{
private ObservableCollection<ColorItemViewModel>? _colors;
public ObservableCollection<ColorItemViewModel> Color { get; set; } = [];
public ObservableCollection<ColorItemViewModel>? Color
{
get => _colors;
set => SetProperty(ref _colors, value);
}
private string? _seriesName;
public string? SeriesName
{
get => _seriesName;
set => SetProperty(ref _seriesName, value);
}
[ObservableProperty] private string? _seriesName;
internal void Initialize(IResourceDictionary? resourceDictionary, string color, bool light)
{
if (resourceDictionary is null)
{
return;
}
if (resourceDictionary is null) return;
SeriesName = color;
Color = [];
for (var i = 0; i < 10; i++)
{
var key = "Semi" + color + i;
if (resourceDictionary.TryGetValue(key, out var value))
var key = $"Semi{color}{i}";
if (resourceDictionary.TryGetValue(key, out var value) && value is ISolidColorBrush brush)
{
if (value is ISolidColorBrush brush)
{
string name = color + " " + i;
var item = new ColorItemViewModel(name, brush, key, light, i);
item.ColorResourceKey = item.ResourceKey + "Color";
Color.Add(item);
}
var name = $"{color} {i}";
var item = new ColorItemViewModel(name, brush, key, light, i);
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
{
get => _brush;
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 string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
int index)
@@ -212,7 +148,8 @@ public class ColorItemViewModel : ObservableObject
ColorDisplayName = colorDisplayName;
Brush = brush;
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))
{
TextBrush = Brushes.Black;
@@ -224,16 +161,9 @@ public class ColorItemViewModel : ObservableObject
}
}
public class FunctionalColorGroupViewModel : ObservableObject
public partial class FunctionalColorGroupViewModel : ObservableObject
{
private string _title = null!;
public string Title
{
get => _title;
set => SetProperty(ref _title, value);
}
[ObservableProperty] private string? _title;
public ObservableCollection<ColorItemViewModel> LightColors { get; set; } = [];
public ObservableCollection<ColorItemViewModel> DarkColors { get; set; } = [];
@@ -262,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
{
get => _shadowDisplayName;
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 string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
public ShadowItemViewModel(string shadowDisplayName, BoxShadows boxShadows, string resourceKey)
{
@@ -296,16 +211,9 @@ public class ShadowItemViewModel : ObservableObject
}
}
public class ShadowGroupViewModel : ObservableObject
public partial class ShadowGroupViewModel : ObservableObject
{
private string _title = null!;
public string Title
{
get => _title;
set => SetProperty(ref _title, value);
}
[ObservableProperty] private string? _title;
public ObservableCollection<ShadowItemViewModel> LightShadows { get; set; } = [];
public ObservableCollection<ShadowItemViewModel> DarkShadows { get; set; } = [];
@@ -333,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"),
};
}

View File

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

View File

@@ -11,14 +11,6 @@
x:CompileBindings="True"
x:DataType="views:MainViewModel"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="../Themes/TabMenu.axaml" />
<ResourceInclude Source="../Themes/ToggleSwitch.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid RowDefinitions="Auto, *">
<Border
Grid.Row="0"
@@ -29,7 +21,8 @@
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSwitch
Name="ExpandButton"
Theme="{DynamicResource SplitViewToggleSwitch}" />
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Content="{StaticResource SemiIconSidebar}" />
<SelectableTextBlock
VerticalAlignment="Center"
Classes="H6"
@@ -44,36 +37,27 @@
Text="{ReflectionBinding #tab.SelectedItem.Header}" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
<Setter Property="Padding" Value="8" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Style>
<Style Selector="ToggleSwitch">
<Setter Property="Theme" Value="{DynamicResource ThemeToggleSwitch}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Style>
<Style Selector="PathIcon">
<Setter Property="Theme" Value="{DynamicResource InnerPathIcon}" />
</Style>
</StackPanel.Styles>
<Button
Theme="{DynamicResource IconBorderlessButton}"
Command="{Binding OpenUrlCommand}"
CommandParameter="{Binding DocumentationUrl}"
Content="{StaticResource SemiIconGlobe}" />
<Button Command="{Binding OpenUrlCommand}" CommandParameter="{Binding DocumentationUrl}">
<PathIcon Data="{StaticResource SemiIconGlobe}" />
</Button>
<Button Command="{Binding OpenUrlCommand}" CommandParameter="{Binding RepoUrl}">
<PathIcon Data="{StaticResource SemiIconGithubLogo}" />
</Button>
<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>
<PathIcon Data="{StaticResource SemiIconMenu}" />
<Button
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconMenu}">
<Button.Flyout>
<MenuFlyout Placement="Bottom" ItemsSource="{Binding MenuItems}" />
</Button.Flyout>
@@ -107,6 +91,9 @@
<TabItem Header="HighContrastTheme">
<pages:HighContrastDemo />
</TabItem>
<TabItem Header="Variables">
<pages:VariablesDemo />
</TabItem>
<TabItem Header="Icon">
<pages:IconDemo />
</TabItem>

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
@@ -32,9 +33,14 @@ public partial class MainViewModel : ObservableObject
[
new MenuItemViewModel
{
Header = "High Contrast Theme",
Header = "Theme",
Items =
[
new MenuItemViewModel
{
Header = "Auto",
Command = FollowSystemThemeCommand
},
new MenuItemViewModel
{
Header = "Aquatic",
@@ -60,10 +66,71 @@ public partial class MainViewModel : ObservableObject
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")
},
new MenuItemViewModel
{
Header = "Español",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("es-es")
},
]
}
];
}
[RelayCommand]
private void FollowSystemTheme()
{
Application.Current?.RegisterFollowSystemTheme();
}
[RelayCommand]
private void ToggleTheme()
{
@@ -71,16 +138,24 @@ public partial class MainViewModel : ObservableObject
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 not null)
{
app.RequestedThemeVariant = obj as ThemeVariant;
}
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]

View File

@@ -8,7 +8,7 @@
Title="Semi.Avalonia.Demo"
d:DesignHeight="450"
d:DesignWidth="800"
Icon="/Assets/avalonia-logo.ico"
Icon="/Assets/irihi.ico"
mc:Ignorable="d">
<views:MainView />
</Window>

View File

@@ -2,11 +2,10 @@
x:Class="Semi.Avalonia.TreeDataGrid.Demo.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
xmlns:semi="https://irihi.tech/semi">
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<semi:SemiTheme Locale="zh-CN" />
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
</Application.Styles>
</Application>

View File

@@ -3,15 +3,13 @@ using System.Collections.Generic;
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Avalonia.Metadata;
namespace Semi.Avalonia.TreeDataGrid.Demo.Converters;
public class FileIconConverter: IMultiValueConverter
public class FileIconConverter : IMultiValueConverter
{
[Content]
public Dictionary<string, PathGeometry> Items { get; set; } = new Dictionary<string, PathGeometry>();
[Content] public IDictionary<string, object?> Items { get; } = new Dictionary<string, object?>();
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
@@ -21,8 +19,10 @@ public class FileIconConverter: IMultiValueConverter
{
return Items["file"];
}
return isOpen ? Items["folderOpen"] : Items["folderClosed"];
}
return AvaloniaProperty.UnsetValue;
}
}

View File

@@ -13,9 +13,9 @@
mc:Ignorable="d">
<Window.Resources>
<converters:FileIconConverter x:Key="FileIconConverter">
<PathGeometry x:Key="file">M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z</PathGeometry>
<PathGeometry x:Key="folderOpen">M6.1,10L4,18V8H21A2,2 0 0,0 19,6H12L10,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H19C19.9,20 20.7,19.4 20.9,18.5L23.2,10H6.1M19,18H6L7.6,12H20.6L19,18Z</PathGeometry>
<PathGeometry x:Key="folderClosed">M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z</PathGeometry>
<StaticResource x:Key="file" ResourceKey="SemiIconFile" />
<StaticResource x:Key="folderOpen" ResourceKey="SemiIconFolderOpen" />
<StaticResource x:Key="folderClosed" ResourceKey="SemiIconFolder" />
</converters:FileIconConverter>
</Window.Resources>
<Grid RowDefinitions="Auto, *">
@@ -58,7 +58,7 @@
</TreeDataGrid.Resources>
<TreeDataGrid.Styles>
<Style Selector="TreeDataGrid TreeDataGridRow:nth-last-child(2n)">
<Setter Property="Background" Value="#20808080" />
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
</Style>
</TreeDataGrid.Styles>
</TreeDataGrid>
@@ -86,10 +86,8 @@
<DataTemplate x:Key="FileNameCell" DataType="vm:FileNodeViewModel">
<StackPanel Orientation="Horizontal">
<PathIcon
Width="16"
Height="16"
Margin="8,0"
VerticalAlignment="Center">
Theme="{StaticResource InnerPathIcon}"
Margin="8,0">
<PathIcon.Data>
<MultiBinding Converter="{StaticResource FileIconConverter}">
<Binding Path="IsDirectory" />
@@ -127,7 +125,7 @@
</TreeDataGrid.Resources>
<TreeDataGrid.Styles>
<Style Selector="TreeDataGrid TreeDataGridRow:nth-child(2n)">
<Setter Property="Background" Value="#20808080" />
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
</Style>
</TreeDataGrid.Styles>
</TreeDataGrid>
@@ -135,4 +133,4 @@
</TabItem>
</TabControl>
</Grid>
</Window>
</Window>

View File

@@ -1,10 +1,10 @@
using Avalonia;
using System;
using System;
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.TreeDataGrid.Demo;
class Program
sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized

View File

@@ -12,18 +12,21 @@
<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->
</PropertyGroup>
<Import Project="../Directory.Build.props" />
<Import Project="../Directory.Build.props"/>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia" 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)" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)" />
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitVersion)"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj" />
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj" />
<ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
</ItemGroup>
</Project>

View File

@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>11.2.1.2</Version>
<Version>11.2.1.6</Version>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>

View File

@@ -0,0 +1,3 @@
using Avalonia.Metadata;
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]

View File

@@ -1,62 +1,48 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Avalonia.Controls"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:primitives="using:Avalonia.Controls.Primitives"
x:CompileBindings="True">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorView.axaml" />
</ResourceDictionary.MergedDictionaries>
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<converters:ToBrushConverter x:Key="ToBrushConverter" />
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Height" Value="32" />
<Setter Property="Width" Value="64" />
<Setter Property="MinWidth" Value="64" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
<Setter Property="Content">
<Template>
<Panel>
<Border
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius,
Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
<Border
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius,
Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
</Panel>
</Template>
</Setter>
<Setter Property="Palette">
<controls:FluentColorPalette />
<FluentColorPalette />
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
ClipToBounds="True"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
ClipToBounds="True"
UseLayoutRounding="False">
<DropDownButton.Styles>
<Style Selector="FlyoutPresenter.nopadding">
@@ -76,7 +62,6 @@
Width="300"
Height="300"
RowDefinitions="*,Auto">
<Grid.Styles />
<!-- Backgrounds -->
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
<Border
@@ -114,13 +99,10 @@
<!-- Spectrum Tab -->
<TabItem IsVisible="{TemplateBinding IsColorSpectrumVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewSpectrumIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewSpectrumIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<Grid Margin="12" RowDefinitions="*">
<Grid.ColumnDefinitions>
@@ -128,7 +110,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="32" />
</Grid.ColumnDefinitions>
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumThirdComponentSlider"
Grid.Column="0"
Margin="0,0,12,0"
@@ -142,7 +124,7 @@
IsPerceptive="False"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<primitives:ColorSpectrum
<ColorSpectrum
Name="ColorSpectrum"
Grid.Column="1"
HorizontalAlignment="Stretch"
@@ -156,7 +138,7 @@
MinSaturation="{TemplateBinding MinSaturation}"
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumAlphaSlider"
Grid.Column="2"
Margin="12,0,0,0"
@@ -168,24 +150,21 @@
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<primitives:ColorSlider.IsVisible>
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</primitives:ColorSlider.IsVisible>
</primitives:ColorSlider>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
<!-- Palette Tab -->
<TabItem IsVisible="{TemplateBinding IsColorPaletteVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewPaletteIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewPaletteIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<ListBox
Margin="12"
@@ -218,18 +197,15 @@
<!-- Components Tab -->
<TabItem IsVisible="{TemplateBinding IsColorComponentsVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewComponentsIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewComponentsIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<Grid
Margin="12"
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,1*,1*,1*,1*,12"
RowDefinitions="Auto,24,*,*,*,*,12"
Tag="{TemplateBinding ColorModel}">
<Grid.Styles>
<Style Selector="NumericUpDown">
@@ -273,13 +249,13 @@
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
ColumnDefinitions="1*,12,1*">
ColumnDefinitions="*,12,*">
<!-- RadioButtonGroup -->
<Border
Padding="2"
Background="{DynamicResource ColorViewRadioButtonPointeroverBackground}"
CornerRadius="3">
<Grid ColumnDefinitions="1*,1*" IsVisible="{TemplateBinding IsColorModelVisible}">
<Grid ColumnDefinitions="*,*" IsVisible="{TemplateBinding IsColorModelVisible}">
<RadioButton
Name="RgbRadioButton"
Grid.Column="0"
@@ -288,9 +264,9 @@
Content="RGB"
CornerRadius="3,0,0,3"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorModel.Rgba},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
<RadioButton
Name="HsvRadioButton"
@@ -300,21 +276,20 @@
Content="HSV"
CornerRadius="0,3,3,0"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorModel.Hsva},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
</Grid>
</Border>
<TextBox
Name="PART_HexTextBox"
Grid.Column="2"
Height="32"
HorizontalAlignment="Stretch"
AutomationProperties.Name="Hexadecimal Color"
InnerLeftContent="#"
IsVisible="{TemplateBinding IsHexInputVisible}"
MaxLength="9" />
MaxLength="8" />
</Grid>
<!-- Color component editing controls -->
<!-- Component 1 RGB:Red HSV:Hue -->
@@ -333,15 +308,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -364,15 +338,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -395,15 +368,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -433,34 +405,33 @@
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
<primitives:ColorSlider
<ColorSlider
Name="AlphaComponentSlider"
Grid.Row="5"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
Orientation="Horizontal"
TickFrequency="1">
<primitives:ColorSlider.IsVisible>
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</primitives:ColorSlider.IsVisible>
</primitives:ColorSlider>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<primitives:ColorPreviewer
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
@@ -472,9 +443,9 @@
</DropDownButton>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ DropDownButton">
<Setter Property="Padding" Value="0 0 10 0"></Setter>
<Setter Property="Padding" Value="0 0 10 0" />
</Style>
</ControlTheme>
@@ -482,7 +453,7 @@
x:Key="HexColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker">
<Setter Property="Width" Value="200" />
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
@@ -500,8 +471,7 @@
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
@@ -526,9 +496,12 @@
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
ClipToBounds="True"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
@@ -558,7 +531,7 @@
Grid.Row="0"
CornerRadius="8 8 0 0"
ClipToBounds="True">
<primitives:ColorSpectrum
<ColorSpectrum
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -572,7 +545,7 @@
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
</Border>
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumThirdComponentSlider"
Grid.Row="1"
HorizontalAlignment="Stretch"
@@ -584,7 +557,7 @@
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Horizontal" />
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
@@ -598,8 +571,7 @@
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
TickFrequency="1"
Orientation="Horizontal">
</primitives:ColorSlider>
Orientation="Horizontal" />
<StackPanel
Grid.Row="3"
HorizontalAlignment="Stretch"
@@ -676,7 +648,7 @@
x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker">
<Setter Property="Width" Value="200" />
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
@@ -694,8 +666,7 @@
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
@@ -710,4 +681,4 @@
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -33,17 +33,16 @@
Name="PART_AccentDecrement2Border"
Grid.Column="0"
Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter},
ConverterParameter='-2'}"
CornerRadius="{TemplateBinding CornerRadius,
Converter={StaticResource LeftCornerRadiusFilterConverter}}"
Converter={StaticResource AccentColorConverter},
ConverterParameter='-2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource LeftCornerRadiusFilterConverter}}"
Tag="-2" />
<Border
Name="PART_AccentDecrement1Border"
Grid.Column="1"
Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter},
ConverterParameter='-1'}"
Converter={StaticResource AccentColorConverter},
ConverterParameter='-1'}"
Tag="-1" />
</Grid>
<!-- Right accent colors -->
@@ -63,17 +62,16 @@
Name="PART_AccentIncrement1Border"
Grid.Column="0"
Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter},
ConverterParameter='1'}"
Converter={StaticResource AccentColorConverter},
ConverterParameter='1'}"
Tag="1" />
<Border
Name="PART_AccentIncrement2Border"
Grid.Column="1"
Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter},
ConverterParameter='2'}"
CornerRadius="{TemplateBinding CornerRadius,
Converter={StaticResource RightCornerRadiusFilterConverter}}"
Converter={StaticResource AccentColorConverter},
ConverterParameter='2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource RightCornerRadiusFilterConverter}}"
Tag="2" />
</Grid>
<!-- Preview color: Must be last for drop shadow Z-index -->
@@ -85,12 +83,13 @@
BoxShadow="{DynamicResource ColorPreviewerMainBoxShadow}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel>
<Border Background="{DynamicResource ColorControlCheckeredBackgroundBrush}" CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
</Panel>
</Border>
@@ -100,15 +99,15 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="{TemplateBinding CornerRadius}"
IsVisible="{TemplateBinding IsAccentColorsVisible,
Converter={x:Static BoolConverters.Not}}">
IsVisible="{TemplateBinding IsAccentColorsVisible,Converter={x:Static BoolConverters.Not}}">
<Panel>
<Border Background="{DynamicResource ColorControlCheckeredBackgroundBrush}" CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
</Panel>
</Border>

View File

@@ -11,19 +11,17 @@
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="BorderBrush" Value="{DynamicResource ColorSliderDefaultBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
<Setter Property="CornerRadius" Value="999" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border
Margin="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
BoxShadow="{DynamicResource ColorSliderBoxShadow}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter.Value>
<ControlTemplate>
<Border
Margin="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
BoxShadow="{DynamicResource ColorSliderBoxShadow}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
@@ -45,20 +43,16 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Track
Name="PART_Track"
Height="12"
@@ -68,8 +62,7 @@
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Horizontal"
Value="{TemplateBinding Value,
Mode=TwoWay}">
Value="{TemplateBinding Value,Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
@@ -106,10 +99,8 @@
</Track.IncreaseButton>
<Thumb
Name="ColorSliderThumb"
Width="16"
Height="16"
Margin="0"
Padding="0"
Width="{TemplateBinding Height}"
Height="{TemplateBinding Height}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
</Track>
@@ -136,20 +127,16 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Track
Name="PART_Track"
Width="12"
@@ -159,8 +146,7 @@
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Vertical"
Value="{TemplateBinding Value,
Mode=TwoWay}">
Value="{TemplateBinding Value,Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
@@ -199,8 +185,6 @@
Name="ColorSliderThumb"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Width}"
Margin="0"
Padding="0"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
</Track>
@@ -231,4 +215,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,125 +1,115 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Avalonia.Controls"
xmlns:converters="using:Avalonia.Controls.Converters"
x:CompileBindings="True">
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
<Setter Property="CornerRadius" Value="6" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ColorSpectrum}">
<ControlTemplate TargetType="{x:Type ColorSpectrum}">
<Panel
Name="PART_LayoutRoot"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Panel
Name="PART_LayoutRoot"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Panel
Name="PART_SizingPanel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ClipToBounds="True">
<Rectangle
Name="PART_SpectrumRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Name="PART_SpectrumOverlayRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse
Name="PART_SpectrumEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" />
<Ellipse
Name="PART_SpectrumOverlayEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" />
<Canvas
Name="PART_InputTarget"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent">
<!-- Note: ToolTip.VerticalOffset is for touch devices to keep the tip above fingers -->
<Panel
Name="PART_SelectionEllipsePanel"
ToolTip.Placement="Top"
ToolTip.VerticalOffset="-10">
<Ellipse
Name="FocusEllipse"
Margin="-2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="2" />
<Ellipse
Name="SelectionEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="2" />
<ToolTip.Tip>
<!-- Set in code-behind -->
</ToolTip.Tip>
</Panel>
</Canvas>
<Rectangle
Name="BorderRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,
Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,
Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse
Name="BorderEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" />
</Panel>
Name="PART_SizingPanel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ClipToBounds="True">
<Rectangle
Name="PART_SpectrumRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Name="PART_SpectrumOverlayRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse
Name="PART_SpectrumEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Ellipse
Name="PART_SpectrumOverlayEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Canvas
Name="PART_InputTarget"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent">
<!-- Note: ToolTip.VerticalOffset is for touch devices to keep the tip above fingers -->
<Panel
Name="PART_SelectionEllipsePanel"
ToolTip.Placement="Top"
ToolTip.VerticalOffset="-10">
<Ellipse
Name="FocusEllipse"
Margin="-2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="2" />
<Ellipse
Name="SelectionEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="2" />
<ToolTip.Tip>
<!-- Set in code-behind -->
</ToolTip.Tip>
</Panel>
</Canvas>
<Rectangle
Name="BorderRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse
Name="BorderEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
</Panel>
</ControlTemplate>
</Setter.Value>
</Panel>
</ControlTemplate>
</Setter>
<!-- Normal -->
<!-- Separating this allows easier customization in applications -->
<Style Selector="^ /template/ Ellipse#BorderEllipse, ^ /template/ Rectangle#BorderRectangle">
<Style Selector="^ /template/ Ellipse#BorderEllipse,^ /template/ Rectangle#BorderRectangle">
<Setter Property="Stroke" Value="{DynamicResource ColorSpectrumBorderBrush}" />
<Setter Property="StrokeThickness" Value="1" />
</Style>

View File

@@ -1,11 +1,9 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Avalonia.Controls"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:globalization="using:System.Globalization"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:primitives="using:Avalonia.Controls.Primitives"
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters"
x:CompileBindings="True">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
@@ -19,6 +17,15 @@
<cvts:ToColorModel x:Key="ToColorModel" />
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
<Design.PreviewWith>
<ColorView
Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</Design.PreviewWith>
<VisualBrush
x:Key="ColorControlCheckeredBackgroundBrush"
DestinationRect="0,0,8,8"
@@ -116,12 +123,12 @@
</ControlTheme>
<ControlTheme x:Key="ColorViewRadioButton" TargetType="RadioButton">
<Setter Property="RadioButton.Cursor" Value="Hand" />
<Setter Property="RadioButton.FontWeight" Value="{DynamicResource ColorViewRadioButtonFontWeight}" />
<Setter Property="RadioButton.Padding" Value="{DynamicResource ColorViewRadioButtonPadding}" />
<Setter Property="RadioButton.Foreground" Value="{DynamicResource ColorViewRadioButtonForeground}" />
<Setter Property="RadioButton.Background" Value="{DynamicResource ColorViewRadioButtonBackground}" />
<Setter Property="RadioButton.Template">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="FontWeight" Value="{DynamicResource ColorViewRadioButtonFontWeight}" />
<Setter Property="Padding" Value="{DynamicResource ColorViewRadioButtonPadding}" />
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonBackground}" />
<Setter Property="Template">
<ControlTemplate TargetType="RadioButton">
<ContentPresenter
Name="PART_ContentPresenter"
@@ -163,10 +170,10 @@
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView">
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="ColorView.Width" Value="300" />
<Setter Property="ColorView.Height" Value="300" />
<Setter Property="ColorView.Palette">
<controls:FluentColorPalette />
<Setter Property="Width" Value="300" />
<Setter Property="Height" Value="300" />
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
@@ -208,13 +215,10 @@
<!-- Spectrum Tab -->
<TabItem IsVisible="{TemplateBinding IsColorSpectrumVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewSpectrumIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewSpectrumIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<Grid Margin="12" RowDefinitions="*">
<Grid.ColumnDefinitions>
@@ -222,7 +226,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="32" />
</Grid.ColumnDefinitions>
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumThirdComponentSlider"
Grid.Column="0"
Margin="0,0,12,0"
@@ -236,7 +240,7 @@
IsPerceptive="False"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<primitives:ColorSpectrum
<ColorSpectrum
Name="ColorSpectrum"
Grid.Column="1"
HorizontalAlignment="Stretch"
@@ -250,7 +254,7 @@
MinSaturation="{TemplateBinding MinSaturation}"
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumAlphaSlider"
Grid.Column="2"
Margin="12,0,0,0"
@@ -262,24 +266,21 @@
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<primitives:ColorSlider.IsVisible>
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</primitives:ColorSlider.IsVisible>
</primitives:ColorSlider>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
<!-- Palette Tab -->
<TabItem IsVisible="{TemplateBinding IsColorPaletteVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewPaletteIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewPaletteIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<ListBox
Margin="12"
@@ -312,18 +313,15 @@
<!-- Components Tab -->
<TabItem IsVisible="{TemplateBinding IsColorComponentsVisible}">
<TabItem.Header>
<Border Height="{DynamicResource ColorViewTabStripHeight}">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource ColorViewComponentsIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</Border>
<PathIcon
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource ColorViewComponentsIconGlyph}"
Foreground="{Binding $parent[TabItem].Foreground}" />
</TabItem.Header>
<Grid
Margin="12"
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,1*,1*,1*,1*,12"
RowDefinitions="Auto,24,*,*,*,*,12"
UseLayoutRounding="False">
<Grid.Styles>
<Style Selector="NumericUpDown">
@@ -339,13 +337,13 @@
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
ColumnDefinitions="1*,12,1*">
ColumnDefinitions="*,12,*">
<!-- RadioButtonGroup -->
<Border
Padding="2"
Background="{DynamicResource ColorViewRadioButtonPointeroverBackground}"
CornerRadius="3">
<Grid ColumnDefinitions="1*,1*" IsVisible="{TemplateBinding IsColorModelVisible}">
<Grid ColumnDefinitions="*,*" IsVisible="{TemplateBinding IsColorModelVisible}">
<RadioButton
Name="RgbRadioButton"
Grid.Column="0"
@@ -354,9 +352,9 @@
Content="RGB"
CornerRadius="3,0,0,3"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorModel.Rgba},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Rgba},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
<RadioButton
Name="HsvRadioButton"
@@ -366,16 +364,15 @@
Content="HSV"
CornerRadius="0,3,3,0"
IsChecked="{TemplateBinding ColorModel,
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static controls:ColorModel.Hsva},
Mode=TwoWay}"
Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorModel.Hsva},
Mode=TwoWay}"
Theme="{DynamicResource ColorViewRadioButton}" />
</Grid>
</Border>
<TextBox
Name="PART_HexTextBox"
Grid.Column="2"
Height="32"
HorizontalAlignment="Stretch"
AutomationProperties.Name="Hexadecimal Color"
InnerLeftContent="#"
@@ -399,15 +396,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -430,15 +426,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -461,15 +456,14 @@
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
<primitives:ColorSlider
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -499,34 +493,33 @@
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
<primitives:ColorSlider
<ColorSlider
Name="AlphaComponentSlider"
Grid.Row="5"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,
Mode=OneWay}"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
Orientation="Horizontal"
TickFrequency="1">
<primitives:ColorSlider.IsVisible>
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</primitives:ColorSlider.IsVisible>
</primitives:ColorSlider>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<primitives:ColorPreviewer
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
@@ -583,7 +576,7 @@
Grid.Row="0"
CornerRadius="8 8 0 0"
ClipToBounds="True">
<primitives:ColorSpectrum
<ColorSpectrum
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -597,7 +590,7 @@
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
</Border>
<primitives:ColorSlider
<ColorSlider
Name="ColorSpectrumThirdComponentSlider"
Grid.Row="1"
HorizontalAlignment="Stretch"
@@ -609,8 +602,8 @@
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Horizontal" />
<primitives:ColorSlider
Name="ColorSpectrumAlphaSlider"
<ColorSlider
x:Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
@@ -623,8 +616,7 @@
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
TickFrequency="1"
Orientation="Horizontal">
</primitives:ColorSlider>
Orientation="Horizontal" />
<StackPanel
Grid.Row="3"
HorizontalAlignment="Stretch"
@@ -693,13 +685,4 @@
<Setter Property="Width" Value="176" />
</Style>
</ControlTheme>
<Design.PreviewWith>
<ColorView
Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</Design.PreviewWith>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -0,0 +1,12 @@
<ResourceDictionary
x:CompileBindings="True"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorView.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -1,21 +1,17 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ColorViewRadioButtonForeground" Color="#54A9FF" />
<SolidColorBrush x:Key="ColorViewRadioButtonBackground" Color="#1C1F23" />
<SolidColorBrush x:Key="ColorViewRadioButtonPointeroverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="ColorViewRadioButtonPressedBackground" Opacity="0.20" Color="White" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedForeground" Color="White" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedBackground" Color="#54A9FF" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedPointeroverBackground" Color="#7FC1FF" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedPressedBackground" Color="#A9D7FF" />
<SolidColorBrush x:Key="ColorViewTabItemSelectedForeground" Color="#54A9FF" />
<SolidColorBrush x:Key="ColorSliderDefaultBorderBrush" Color="Black" />
<SolidColorBrush x:Key="ColorSliderLightBorderBrush" Color="White" />
<SolidColorBrush x:Key="ColorSliderDarkBorderBrush" Color="#E4000000" />
<SolidColorBrush x:Key="ColorSpectrumBorderBrush" Opacity="0.08" Color="#1C1F23" />
<BoxShadows x:Key="ColorPreviewerMainBoxShadow">inset 0 0 0 1 #1AFFFFFF, 0 4 14 #40000000</BoxShadows>
<StaticResource x:Key="ColorViewRadioButtonForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorViewRadioButtonBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="ColorViewRadioButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="ColorViewRadioButtonPressedBackground" ResourceKey="SemiColorFill2" />
<StaticResource x:Key="ColorViewRadioButtonCheckedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ColorViewRadioButtonCheckedBackground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorViewRadioButtonCheckedPointeroverBackground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ColorViewRadioButtonCheckedPressedBackground" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ColorViewTabItemSelectedForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorSliderDefaultBorderBrush" ResourceKey="SemiColorBlack" />
<StaticResource x:Key="ColorSliderLightBorderBrush" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ColorSliderDarkBorderBrush" ResourceKey="SemiColorBlack" />
<StaticResource x:Key="ColorSpectrumBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="ColorPreviewerMainBoxShadow" ResourceKey="SemiShadowElevated" />
<BoxShadows x:Key="ColorSliderBoxShadow">0 0 2 1 #FFFFFF</BoxShadows>
</ResourceDictionary>

View File

@@ -6,7 +6,7 @@
<ResourceInclude x:Key="Dark" Source="avares://Semi.Avalonia.ColorPicker/Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/_index.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Shared.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -1,21 +1,17 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ColorViewRadioButtonForeground" Color="#0077FA" />
<SolidColorBrush x:Key="ColorViewRadioButtonBackground" Color="White" />
<SolidColorBrush x:Key="ColorViewRadioButtonPointeroverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="ColorViewRadioButtonPressedBackground" Opacity="0.13" Color="#2E3238" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedForeground" Color="White" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedBackground" Color="#0077FA" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedPointeroverBackground" Color="#0062D6" />
<SolidColorBrush x:Key="ColorViewRadioButtonCheckedPressedBackground" Color="#004FB3" />
<SolidColorBrush x:Key="ColorViewTabItemSelectedForeground" Color="#0077FA" />
<SolidColorBrush x:Key="ColorSliderDefaultBorderBrush" Color="Black" />
<SolidColorBrush x:Key="ColorSliderLightBorderBrush" Color="White" />
<SolidColorBrush x:Key="ColorSliderDarkBorderBrush" Color="#E4000000" />
<SolidColorBrush x:Key="ColorSpectrumBorderBrush" Opacity="0.08" Color="#1C1F23" />
<BoxShadows x:Key="ColorPreviewerMainBoxShadow">0 0 1 #4A000000, 0 4 14 #1A000000</BoxShadows>
<StaticResource x:Key="ColorViewRadioButtonForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorViewRadioButtonBackground" ResourceKey="SemiColorBackground0" />
<StaticResource x:Key="ColorViewRadioButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="ColorViewRadioButtonPressedBackground" ResourceKey="SemiColorFill2" />
<StaticResource x:Key="ColorViewRadioButtonCheckedForeground" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ColorViewRadioButtonCheckedBackground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorViewRadioButtonCheckedPointeroverBackground" ResourceKey="SemiColorPrimaryPointerover" />
<StaticResource x:Key="ColorViewRadioButtonCheckedPressedBackground" ResourceKey="SemiColorPrimaryActive" />
<StaticResource x:Key="ColorViewTabItemSelectedForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="ColorSliderDefaultBorderBrush" ResourceKey="SemiColorBlack" />
<StaticResource x:Key="ColorSliderLightBorderBrush" ResourceKey="SemiColorWhite" />
<StaticResource x:Key="ColorSliderDarkBorderBrush" ResourceKey="SemiColorBlack" />
<StaticResource x:Key="ColorSpectrumBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="ColorPreviewerMainBoxShadow" ResourceKey="SemiShadowElevated" />
<BoxShadows x:Key="ColorSliderBoxShadow">0 0 2 1 #FFFFFF</BoxShadows>
</ResourceDictionary>

View File

@@ -4,7 +4,7 @@
<PropertyGroup>
<Title>Semi.Avalonia.ColorPicker</Title>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.2.1.2</PackageReleaseNotes>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.2.1.6</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
@@ -12,7 +12,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
</ItemGroup>

View File

@@ -1,30 +1,31 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:colorPicker="clr-namespace:Semi.Avalonia.ColorPicker">
<FontWeight x:Key="ColorViewRadioButtonFontWeight">600</FontWeight>
xmlns:semi="https://irihi.tech/semi">
<StaticResource x:Key="ColorViewRadioButtonFontWeight" ResourceKey="SemiFontWeightBold" />
<Thickness x:Key="ColorViewRadioButtonPadding">16 4</Thickness>
<x:Double x:Key="ColorViewNumericUpDownWidth">70</x:Double>
<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>
<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 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>
<!-- <StaticResource x:Key="ColorViewSpectrumIconGlyph" ResourceKey="SemiIconEyedropper" /> -->
<!-- <StaticResource x:Key="ColorViewPaletteIconGlyph" ResourceKey="SemiIconColorPalette" /> -->
<!-- <StaticResource x:Key="ColorViewComponentsIconGlyph" ResourceKey="SemiIconList" /> -->
<StaticResource x:Key="ColorViewSpectrumIconGlyph" ResourceKey="SemiIconEyedropper" />
<StaticResource x:Key="ColorViewPaletteIconGlyph" ResourceKey="SemiIconColorPalette" />
<StaticResource x:Key="ColorViewComponentsIconGlyph" ResourceKey="SemiIconList" />
<x:Double x:Key="ColorSliderWidth">16</x:Double>
<CornerRadius x:Key="ColorSliderCornerRadius">6</CornerRadius>
<Thickness x:Key="ColorSliderThumbBorderBrush">2</Thickness>
<BoxShadows x:Key="ColorSliderBoxShadow">0 0 2 1 #FFFFFF</BoxShadows>
<StaticResource x:Key="ColorSliderWidth" ResourceKey="SemiSpacingBase" />
<StaticResource x:Key="ColorSliderCornerRadius" ResourceKey="SemiBorderRadiusMedium" />
<StaticResource x:Key="ColorSliderThumbBorderBrush" ResourceKey="SemiThicknessSuperTight" />
<StaticResource x:Key="ColorSliderThumbCornerRadius" ResourceKey="SemiBorderRadiusFull" />
<x:Double x:Key="ColorPreviewerAccentSectionWidth">80</x:Double>
<x:Double x:Key="ColorPreviewerAccentSectionHeight">20</x:Double>
<x:Double x:Key="ColorPreviewerHeight">48</x:Double>
<CornerRadius x:Key="ColorPreviewerCornerRadius">3</CornerRadius>
<StaticResource x:Key="ColorPreviewerCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<colorPicker:SemiColorDarkPalette x:Key="SemiColorPalette" />
<semi:SemiColorDarkPalette x:Key="SemiColorPalette" />
<StaticResource x:Key="ColorSpectrumCornerRadius" ResourceKey="SemiBorderRadiusMedium" />
<StaticResource x:Key="ColorPickerMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="ColorPickerCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<PlacementMode x:Key="ColorPickerFlyoutPlacement">AnchorAndGravity</PlacementMode>
<PlacementMode x:Key="SimpleColorPickerFlyoutPlacement">BottomEdgeAlignedLeft</PlacementMode>
</ResourceDictionary>

View File

@@ -1,29 +1,21 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="DataGridLineBrush" Opacity="0.08" Color="White" />
<StaticResource x:Key="DataGridLineBrush" ResourceKey="SemiColorBorder" />
<SolidColorBrush x:Key="DataGridCellBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridCellFocusBorderBrush" Color="#41464C" />
<SolidColorBrush x:Key="DataGridCellCurrentBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="DataGridCellErrorBrush" Color="#6C090B" />
<SolidColorBrush x:Key="DataGridColumnHeaderForeground" Opacity="0.6" Color="#F9F9F9" />
<StaticResource x:Key="DataGridCellFocusBorderBrush" ResourceKey="SemiColorTertiaryLightActive" />
<StaticResource x:Key="DataGridCellCurrentBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="DataGridCellErrorBrush" ResourceKey="SemiColorDangerLight" />
<StaticResource x:Key="DataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />
<SolidColorBrush x:Key="DataGridColumnHeaderBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridColumnHeaderPointeroverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="DataGridColumnHeaderPressedBackground" Opacity="0.20" Color="White" />
<StaticResource x:Key="DataGridColumnHeaderPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="DataGridColumnHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="DataGridRowBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridRowErrorBackground" Color="#6C090B" />
<StaticResource x:Key="DataGridRowErrorBackground" ResourceKey="SemiColorDangerLight" />
<SolidColorBrush x:Key="DataGridDetailsPresenterBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridRowPointeroverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="DataGridRowSelectedBackground" Opacity="0.2" Color="#FF54A9FF" />
<SolidColorBrush x:Key="DataGridRowSelectedPointeroverBackground" Opacity="0.3" Color="#FF54A9FF" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderExpandIconForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderBackground" Opacity="0.12" Color="White" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#E6E8EA" Opacity="0.04" />
<StaticResource x:Key="DataGridRowPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="DataGridRowSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="DataGridRowSelectedPointeroverBackground" ResourceKey="SemiColorPrimaryLightPointerover" />
<StaticResource x:Key="DataGridRowGroupHeaderExpandIconForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="DataGridRowGroupHeaderBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="DataGridRowGroupHeaderCurrentBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="DataGridDisabledBackground" ResourceKey="SemiColorDisabledFill" />
</ResourceDictionary>

View File

@@ -126,21 +126,19 @@
Name="HeaderBackground"
Grid.ColumnSpan="2"
Margin="4"
CornerRadius="3" />
CornerRadius="{DynamicResource DataGridColumnHeaderCornerRadius}" />
<Grid
ColumnDefinitions="*,Auto"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
<ContentPresenter
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<PathIcon
Name="SortIcon"
Grid.Column="1"
Width="8"
Height="8"
Theme="{StaticResource InnerPathIcon}"
Margin="0,0,8,0"
Foreground="{TemplateBinding Foreground}" />
</Grid>
@@ -293,7 +291,7 @@
Grid.ColumnSpan="2"
Margin="{DynamicResource DataGridRowMargin}"
Background="{DynamicResource DataGridRowBackground}"
CornerRadius="3" />
CornerRadius="{DynamicResource DataGridRowCornerRadius}" />
<Rectangle
Name="InvalidVisualElement"
Grid.ColumnSpan="2"
@@ -358,8 +356,7 @@
<Setter Property="Template">
<ControlTemplate TargetType="ToggleButton">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
@@ -375,7 +372,7 @@
<ControlTheme x:Key="{x:Type DataGridRowGroupHeader}" TargetType="DataGridRowGroupHeader">
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource DataGridRowGroupHeaderBackground}" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="MinHeight" Value="{DynamicResource DataGridRowGroupHeaderMinHeight}" />
<Setter Property="Template">
<ControlTemplate x:DataType="collections:DataGridCollectionViewGroup" TargetType="DataGridRowGroupHeader">
<DataGridFrozenGrid
@@ -400,20 +397,18 @@
Grid.Column="3"
Margin="12,0,0,0"
VerticalAlignment="Center"
Orientation="Horizontal">
Orientation="Horizontal"
Spacing="4">
<TextBlock
Name="PART_PropertyNameElement"
Margin="4,0,0,0"
Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding IsPropertyNameVisible}" />
<ContentControl
Name="PART_GroupKeyContentControl"
Margin="4,0,0,0"
Foreground="{TemplateBinding Foreground}"
Content="{Binding Key}" />
<TextBlock
Name="PART_ItemCountElement"
Margin="4,0,0,0"
Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding IsItemCountVisible}" />
</StackPanel>
@@ -530,6 +525,7 @@
Name="PART_VerticalScrollbar"
Grid.Row="1"
Grid.Column="2"
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
Orientation="Vertical" />
<Grid
@@ -540,6 +536,7 @@
<ScrollBar
Name="PART_HorizontalScrollbar"
Grid.Column="1"
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
Height="{DynamicResource ScrollBarSize}"
Orientation="Horizontal" />
</Grid>
@@ -552,7 +549,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource DataGridDisabledBackground}"
CornerRadius="2"
CornerRadius="{DynamicResource DataGridDisabledCornerRadius}"
IsHitTestVisible="False"
IsVisible="{Binding !$parent[DataGrid].IsEnabled}" />
</Grid>
@@ -572,7 +569,7 @@
</Style>
</Style>
<Style Selector="^[(ScrollViewer.AllowAutoHide)=False]">
<Style Selector="^.InsetContent">
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="2" />
@@ -582,4 +579,4 @@
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,29 +1,21 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="DataGridLineBrush" Opacity="0.08" Color="#1C1F23" />
<StaticResource x:Key="DataGridLineBrush" ResourceKey="SemiColorBorder" />
<SolidColorBrush x:Key="DataGridCellBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridCellFocusBorderBrush" Color="#C6CACD" />
<SolidColorBrush x:Key="DataGridCellCurrentBorderBrush" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="DataGridCellErrorBrush" Color="#FEF2ED" />
<SolidColorBrush x:Key="DataGridColumnHeaderForeground" Opacity="0.62" Color="#1C1F23" />
<StaticResource x:Key="DataGridCellFocusBorderBrush" ResourceKey="SemiColorTertiaryLightActive" />
<StaticResource x:Key="DataGridCellCurrentBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="DataGridCellErrorBrush" ResourceKey="SemiColorDangerLight" />
<StaticResource x:Key="DataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />
<SolidColorBrush x:Key="DataGridColumnHeaderBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridColumnHeaderPointeroverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="DataGridColumnHeaderPressedBackground" Opacity="0.13" Color="#2E3238" />
<StaticResource x:Key="DataGridColumnHeaderPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="DataGridColumnHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="DataGridRowBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridRowErrorBackground" Color="#FEF2ED" />
<StaticResource x:Key="DataGridRowErrorBackground" ResourceKey="SemiColorDangerLight" />
<SolidColorBrush x:Key="DataGridDetailsPresenterBackground" Color="Transparent" />
<SolidColorBrush x:Key="DataGridRowPointeroverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="DataGridRowSelectedBackground" Color="#EAF5FF" />
<SolidColorBrush x:Key="DataGridRowSelectedPointeroverBackground" Color="#CBE7FE" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderExpandIconForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderBackground" Opacity="0.05" Color="#2E3238" />
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#2E3238" Opacity="0.02" />
<StaticResource x:Key="DataGridRowPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="DataGridRowSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="DataGridRowSelectedPointeroverBackground" ResourceKey="SemiColorPrimaryLightPointerover" />
<StaticResource x:Key="DataGridRowGroupHeaderExpandIconForeground" ResourceKey="SemiColorText2" />
<StaticResource x:Key="DataGridRowGroupHeaderBackground" ResourceKey="SemiColorFill0" />
<StaticResource x:Key="DataGridRowGroupHeaderCurrentBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="DataGridDisabledBackground" ResourceKey="SemiColorDisabledFill" />
</ResourceDictionary>

View File

@@ -1,10 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Package.props"/>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>11.2.1.6</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.2.1.6</PackageReleaseNotes>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<Title>Semi.Avalonia.DataGrid</Title>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.2.1.2</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
@@ -12,8 +20,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.1"/>
<None Include="irihi.png" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>

View File

@@ -1,23 +1,22 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="DataGridCellTextBlockDefaultMargin">12 0</Thickness>
<x:Double x:Key="DataGridCellMinHeight">32</x:Double>
<Thickness x:Key="DataGridCellVisualBorderThickness">1</Thickness>
<x:Double x:Key="DataGridCellVisualStrokeThickness">1</x:Double>
<StaticResource x:Key="DataGridCellMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="DataGridCellVisualBorderThickness" ResourceKey="SemiBorderThicknessControl" />
<StaticResource x:Key="DataGridCellVisualStrokeThickness" ResourceKey="SemiBorderSpacingControl" />
<Thickness x:Key="DataGridColumnHeaderPadding">12 0 0 0</Thickness>
<x:Double x:Key="DataGridColumnHeaderMinHeight">32</x:Double>
<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.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" /> -->
<StaticResource x:Key="DataGridColumnHeaderMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="DataGridColumnHeaderCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<StaticResource x:Key="DataGridColumnHeaderAscendingGlyph" ResourceKey="SemiIconSmallTriangleTop" />
<StaticResource x:Key="DataGridColumnHeaderDescendingGlyph" ResourceKey="SemiIconSmallTriangleDown" />
<Thickness x:Key="DataGridRowHeaderMargin">8 0</Thickness>
<Thickness x:Key="DataGridRowMargin">2</Thickness>
<StaticResource x:Key="DataGridRowCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<StaticResource x:Key="DataGridRowMargin" ResourceKey="SemiThicknessSuperTight" />
<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" /> -->
<StaticResource x:Key="DataGridRowGroupHeaderMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="DataGridRowGroupHeaderExpandIconGlyph" ResourceKey="SemiIconChevronRight" />
<StaticResource x:Key="DataGridRowGroupHeaderVisualStrokeThickness" ResourceKey="SemiBorderSpacingControl" />
<x:Double x:Key="DataGridRowGroupHeaderVisualStrokeThickness">1</x:Double>
<StaticResource x:Key="DataGridDisabledCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
</ResourceDictionary>

View File

@@ -1,11 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="TreeDataGridGridLinesBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBackground" Opacity="0.20" Color="White" />
<StaticResource x:Key="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="TreeDataGridHeaderPointerOverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverForeground" Opacity="0.8" Color="#F9F9F9" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedForeground" Opacity="1" Color="#F9F9F9" />
<SolidColorBrush x:Key="TreeDataGridCellSelectedBackground" Opacity="0.2" Color="#FF54A9FF" />
<SolidColorBrush x:Key="TreeDataGridColumnHeaderForeground" Opacity="0.6" Color="#F9F9F9" />
</ResourceDictionary>
<StaticResource x:Key="TreeDataGridHeaderPointerOverForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />
</ResourceDictionary>

View File

@@ -1,11 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="TreeDataGridGridLinesBrush" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBackground" Opacity="0.09" Color="#2E3238" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBackground" Opacity="0.13" Color="#2E3238" />
<StaticResource x:Key="TreeDataGridGridLinesBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="TreeDataGridHeaderPointerOverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="TreeDataGridHeaderPressedBackground" ResourceKey="SemiColorFill2" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="TreeDataGridHeaderPointerOverForeground" Opacity="0.8" Color="#1C1F23" />
<SolidColorBrush x:Key="TreeDataGridHeaderPressedForeground" Opacity="1" Color="#1C1F23" />
<SolidColorBrush x:Key="TreeDataGridCellSelectedBackground" Color="#EAF5FF" />
<SolidColorBrush x:Key="TreeDataGridColumnHeaderForeground" Opacity="0.62" Color="#1C1F23" />
</ResourceDictionary>
<StaticResource x:Key="TreeDataGridHeaderPointerOverForeground" ResourceKey="SemiColorText1" />
<StaticResource x:Key="TreeDataGridHeaderPressedForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="TreeDataGridCellSelectedBackground" ResourceKey="SemiColorPrimaryLight" />
<StaticResource x:Key="TreeDataGridColumnHeaderForeground" ResourceKey="SemiColorText2" />
</ResourceDictionary>

View File

@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>11.0.10.1</Version>
<PackageReleaseNotes>Update to 11.0.10.1</PackageReleaseNotes>
<Version>11.0.10.2</Version>
<PackageReleaseNotes>Update to 11.0.10.2</PackageReleaseNotes>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>

View File

@@ -1,9 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<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>
<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 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>
<!-- <StaticResource x:Key="TreeDataGridSortIconAscendingPath" ResourceKey="SemiIconCaretUp"/> -->
<!-- <StaticResource x:Key="TreeDataGridSortIconDescendingPath" ResourceKey="SemiIconCaretDown"/> -->
<!-- <StaticResource x:Key="TreeDataGridItemCollapsedChevronPathData" ResourceKey="SemiIconTreeTriangleRight"/> -->
<Thickness x:Key="TreeDataGridRowMargin">2</Thickness>
<StaticResource x:Key="TreeDataGridSortIconAscendingPath" ResourceKey="SemiIconSmallTriangleTop" />
<StaticResource x:Key="TreeDataGridSortIconDescendingPath" ResourceKey="SemiIconSmallTriangleDown" />
<StaticResource x:Key="TreeDataGridItemCollapsedChevronPathData" ResourceKey="SemiIconTreeTriangleRight" />
<StaticResource x:Key="TreeDataGridItemCollapsedChevronWidth" ResourceKey="SemiWidthIconMedium" />
<StaticResource x:Key="TreeDataGridColumnHeaderCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<StaticResource x:Key="TreeDataGridColumnHeaderMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="TreeDataGridRowCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<StaticResource x:Key="TreeDataGridRowMinHeight" ResourceKey="SemiHeightControlDefault" />
<StaticResource x:Key="TreeDataGridRowMargin" ResourceKey="SemiThicknessSuperTight" />
</ResourceDictionary>

View File

@@ -49,10 +49,10 @@
<ControlTheme x:Key="{x:Type TreeDataGridColumnHeader}" TargetType="TreeDataGridColumnHeader">
<Setter Property="Background" Value="Transparent" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="MinHeight" Value="{DynamicResource TreeDataGridColumnHeaderMinHeight}" />
<Setter Property="Padding" Value="8 2 0 2" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="4" />
<Setter Property="CornerRadius" Value="{DynamicResource TreeDataGridColumnHeaderCornerRadius}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" />
<Setter Property="Template">
@@ -87,11 +87,8 @@
</Panel>
<PathIcon
Name="SortIcon"
Width="8"
Height="8"
Theme="{StaticResource InnerPathIcon}"
Margin="0,0,8,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DockPanel.Dock="Right"
Foreground="{TemplateBinding Foreground}"
TabIndex="1" />
@@ -140,8 +137,8 @@
<ControlTheme x:Key="{x:Type TreeDataGridRow}" TargetType="TreeDataGridRow">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="CornerRadius" Value="{DynamicResource TreeDataGridRowCornerRadius}" />
<Setter Property="MinHeight" Value="{DynamicResource TreeDataGridRowMinHeight}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate>
@@ -192,25 +189,17 @@
</ControlTheme>
<ControlTheme x:Key="TreeDataGridExpandCollapseChevron" TargetType="ToggleButton">
<Setter Property="Margin" Value="0" />
<Setter Property="Width" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" />
<Setter Property="Template">
<ControlTemplate>
<Border
<PathIcon
Name="ChevronPath"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent">
<PathIcon
Name="ChevronPath"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource TreeDataGridItemCollapsedChevronPathData}"
Foreground="{TemplateBinding Foreground}" />
</Border>
Theme="{StaticResource InnerPathIcon}"
Classes="Small"
Data="{DynamicResource TreeDataGridItemCollapsedChevronPathData}"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>
<Style Selector="^:checked /template/ PathIcon#ChevronPath">
@@ -223,18 +212,16 @@
<ControlTemplate>
<Border
Name="CellBorder"
Padding="{TemplateBinding Indent,
Converter={x:Static conv:IndentConverter.Instance}}"
Padding="{TemplateBinding Indent,Converter={x:Static conv:IndentConverter.Instance}}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel>
<Border
Width="12"
Height="12"
Margin="4,0"
DockPanel.Dock="Left">
DockPanel.Dock="Left"
Width="{DynamicResource TreeDataGridItemCollapsedChevronWidth}"
Margin="4,0">
<ToggleButton
Focusable="False"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"
@@ -335,4 +322,4 @@
</Setter>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:ClassModifier="internal">
x:CompileBindings="True">
<ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer">
<Setter Property="DefaultFocusAdorner">
<FocusAdornerTemplate>

View File

@@ -79,12 +79,12 @@
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Border>
</Popup>
</Panel>
@@ -98,4 +98,4 @@
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxSmallHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -31,4 +31,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -108,11 +108,9 @@
Classes="Solid" />
</FocusAdornerTemplate>
</Setter>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
</Style>
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
@@ -272,8 +270,8 @@
</ControlTheme>
<ControlTheme x:Key="InnerIconButton" TargetType="Button">
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Width" Value="{DynamicResource SemiWidthIconMedium}" />
<Setter Property="Height" Value="{DynamicResource SemiWidthIconMedium}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Cursor" Value="Hand" />

View File

@@ -98,7 +98,7 @@
<Setter Property="Margin" Value="0 0 4 0" />
</Style>
<Style Selector="^:pointerover /template/ Border#ButtonGroup">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonPointeroverBorderBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonPointeroverBorderBrush}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -2,6 +2,11 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<Calendar />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type Calendar}" TargetType="Calendar">
<Setter Property="Foreground" Value="{DynamicResource CalendarForeground}" />
<Setter Property="Background" Value="{DynamicResource CalendarBackground}" />
@@ -37,7 +42,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="x:String"
FontSize="12"
FontSize="{DynamicResource CalendarItemWeekDayNameFontSize}"
FontWeight="{DynamicResource CalendarItemWeekDayNameFontWeight}"
Foreground="{DynamicResource CalendarItemWeekDayNameForeground}"
Text="{Binding}" />
</Template>
@@ -58,38 +64,41 @@
VerticalAlignment="Stretch"
RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
<Button
<RepeatButton
Name="PART_PreviousButton"
Grid.Column="0"
HorizontalContentAlignment="Left"
Padding="0"
MinWidth="{Binding $self.MinHeight}"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
Theme="{DynamicResource BorderlessRepeatButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Classes="Large"
Data="{DynamicResource CalendarItemPreviousIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
</RepeatButton>
<Button
Name="PART_HeaderButton"
Grid.Column="1"
HorizontalContentAlignment="Center"
HorizontalAlignment="Stretch"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}" />
<Button
<RepeatButton
Name="PART_NextButton"
Grid.Column="2"
HorizontalContentAlignment="Left"
Padding="0"
MinWidth="{Binding $self.MinHeight}"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
Theme="{DynamicResource BorderlessRepeatButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Classes="Large"
Data="{DynamicResource CalendarItemNextIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
</RepeatButton>
</Grid>
<Grid
Name="PART_MonthView"
@@ -244,4 +253,4 @@
<Setter Property="Foreground" Value="{DynamicResource CalendarItemCalendarDayButtonDisabledForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -13,7 +13,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalendarDatePickerCornerRadius}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge"/>
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -34,7 +34,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"/>
CornerRadius="{TemplateBinding CornerRadius}" />
<Grid
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -227,4 +227,4 @@
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -5,15 +5,14 @@
<Design.PreviewWith>
<CaptionButtons />
</Design.PreviewWith>
<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="CornerRadius" Value="6" />
<Setter Property="Margin" Value="0, 4" />
<Setter Property="Padding" Value="4" />
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="28" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="{StaticResource CaptionButtonCornerRadius}" />
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
@@ -21,77 +20,76 @@
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Background="Transparent"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{TemplateBinding Background}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{TemplateBinding BorderBrush}" />
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type CaptionButtons}" TargetType="CaptionButtons">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
<Setter Property="Margin" Value="0 0 4 0" />
<Setter Property="Template">
<ControlTemplate TargetType="CaptionButtons">
<StackPanel
VerticalAlignment="Stretch"
Orientation="Horizontal"
Spacing="2"
TextElement.FontSize="10">
<StackPanel Orientation="Horizontal">
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
<PathIcon
Name="PART_FullScreenButtonIcon"
Theme="{DynamicResource InnerPathIcon}"
Data="{DynamicResource WindowExpandGlyph}"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowExpandGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button Name="PART_MinimizeButton" Theme="{StaticResource CaptionButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{DynamicResource WindowMinimizeGlyph}"
Name="PART_MinimizeButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowMinimizeGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button Name="PART_RestoreButton" Theme="{StaticResource CaptionButton}">
<PathIcon
Name="PART_RestoreButtonIcon"
Theme="{DynamicResource InnerPathIcon}"
Data="{DynamicResource WindowMaximizeGlyph}"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowMaximizeGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button
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>
<Button Name="PART_CloseButton" Theme="{StaticResource CaptionButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{DynamicResource WindowCloseIconGlyph}"
Name="PART_CloseButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowCloseIconGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
</StackPanel>
</ControlTemplate>
</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">
<Setter Property="Data" Value="{DynamicResource WindowRestoreGlyph}" />
<Setter Property="Data" Value="{StaticResource WindowRestoreGlyph}" />
</Style>
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
<Setter Property="Data" Value="{DynamicResource WindowCollapseGlyph}" />
<Setter Property="Data" Value="{StaticResource WindowCollapseGlyph}" />
</Style>
<Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
<Setter Property="IsVisible" Value="False" />
@@ -100,4 +98,4 @@
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -83,7 +83,7 @@
<ControlTheme x:Key="CarouselIndicatorDotListBoxItem" TargetType="ListBoxItem">
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorForeground}" />
<Setter Property="Margin" Value="4 0"/>
<Setter Property="Margin" Value="4 0" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem">
@@ -108,7 +108,7 @@
<ControlTheme x:Key="CarouselIndicatorLineListBoxItem"
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="Margin" Value="2 0"/>
<Setter Property="Margin" Value="2 0" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem">
<Rectangle
@@ -122,9 +122,9 @@
<ControlTheme x:Key="CarouselIndicatorColumnarListBoxItem"
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="Width" Value="{DynamicResource CarouselIndicatorColumnarWidth}"/>
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}"/>
<Setter Property="Margin" Value="2 0"/>
<Setter Property="Width" Value="{DynamicResource CarouselIndicatorColumnarWidth}" />
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}" />
<Setter Property="Margin" Value="2 0" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem">
<Rectangle
@@ -250,4 +250,4 @@
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -12,7 +12,7 @@
<ComboBoxItem>BBB</ComboBoxItem>
<ComboBoxItem>CCC</ComboBoxItem>
</ComboBox>
<ComboBox Width="100" PlaceholderText="Select">
<ComboBox Width="100" PlaceholderText="Select" PlaceholderForeground="Red">
<ComboBoxItem>AAA</ComboBoxItem>
<ComboBoxItem>BBB</ComboBoxItem>
<ComboBoxItem>CCC</ComboBoxItem>
@@ -44,6 +44,7 @@
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="MinHeight" Value="{DynamicResource ComboBoxDefaultHeight}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource ComboBoxSelectorPlaceHolderForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="ComboBox">
<DataValidationErrors>
@@ -65,9 +66,8 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextTrimming="CharacterEllipsis"
Foreground="{TemplateBinding Foreground}"
Foreground="{TemplateBinding PlaceholderForeground}"
IsVisible="{TemplateBinding SelectionBoxItem,Converter={x:Static ObjectConverters.IsNull}}"
Opacity="0.3"
Text="{TemplateBinding PlaceholderText}" />
<ContentPresenter
Name="ContentPresenter"
@@ -137,7 +137,7 @@
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ PathIcon#DropDownGlyph">
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"/>
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}" />
</Style>
</Style>
@@ -320,4 +320,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -10,9 +10,10 @@
<Setter Property="MaxWidth" Value="{DynamicResource MenuFlyoutMaxWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource MenuFlyoutMinHeight}" />
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutPadding}" />
<Setter Property="Focusable" Value="True"></Setter>
<Setter Property="Focusable" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource MenuFlyoutFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource MenuFlyoutFontWeight}" />
<Setter Property="WindowManagerAddShadowHint" Value="False" />
<Setter Property="Template">
<ControlTemplate TargetType="ContextMenu">
@@ -38,4 +39,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -104,4 +104,4 @@
</DataTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -2,15 +2,19 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<DatePickerPresenter />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
<Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" />
<Setter Property="MaxHeight" Value="300" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerPopupBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerPopupCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="DatePickerPresenter">
<Border
@@ -92,8 +96,7 @@
VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerAcceptGlyph}" />
</Button>
<Rectangle
@@ -107,8 +110,7 @@
VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerDismissGlyph}" />
</Button>
<Rectangle
@@ -169,7 +171,6 @@
<Grid
Name="PART_ButtonContentGrid"
Grid.Column="0"
VerticalAlignment="Center"
ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock
Name="PART_DayTextBlock"
@@ -203,16 +204,12 @@
Name="PART_FirstSpacer"
Grid.Column="1"
Width="1"
Height="{TemplateBinding Height}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Rectangle
Name="PART_SecondSpacer"
Grid.Column="3"
Width="1"
Height="{TemplateBinding Height}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
</Grid>
@@ -273,4 +270,4 @@
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -115,8 +115,8 @@
<Setter Property="Content">
<Template>
<PathIcon
Width="8"
Height="8"
Theme="{StaticResource InnerPathIcon}"
Classes="ExtraSmall"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DateTimePickerButtonUpGlyph}" />
@@ -136,12 +136,12 @@
<Setter Property="Content">
<Template>
<PathIcon
Width="8"
Height="8"
Theme="{StaticResource InnerPathIcon}"
Classes="ExtraSmall"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DateTimePickerButtonDownGlyph}" />
</Template>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -3,6 +3,7 @@
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource DefaultFontWeight}" />
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
<Setter Property="Template">
<ControlTemplate>
@@ -21,4 +22,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -149,4 +149,4 @@
<Setter Property="Foreground" Value="{DynamicResource ExpanderHeaderDisabledForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -90,4 +90,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -26,4 +26,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -16,4 +16,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -170,14 +170,13 @@
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="UseLayoutRounding" Value="False" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{DynamicResource LabelTagSmallPadding}" />
<Setter Property="FontSize" Value="{DynamicResource LabelTagFontSize}" />
<Setter Property="Template">
<ControlTemplate TargetType="Label">
<ContentPresenter
Name="PART_ContentPresenter"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
@@ -406,4 +405,4 @@
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -59,7 +59,6 @@
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
FontWeight="Normal"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>

View File

@@ -195,7 +195,7 @@
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooserOverwritePrompt}"
TargetType="dialogs:ManagedFileChooserOverwritePrompt">
<Setter Property="MaxWidth" Value="400" />
<Setter Property="Padding" Value="10"/>
<Setter Property="Padding" Value="10" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
@@ -233,4 +233,4 @@
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

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