Compare commits

...

21 Commits

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

* create-dmg-update

* Potential fix for pull request finding

OK

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

---------

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

* chore: x:Name->Name.

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

* chore: test on ubuntu.

* feat: add linux options.

* feat: update theme settings and adjust window decorations.

* feat: add font to DRM project.

* misc: net8.0->net10.0
2026-05-18 21:16:03 +08:00
Zhang Dian 331141197d Enhance DrawerPage (#813)
* feat: enhance navigation and UI structure in MainView and Application.

* fix: using ContentPreseter and add HeaderTemplate.

* feat: add locale resource for navigation drawer toggle button text.

* feat: add customizations for DrawerPageDemo.

* fix: fix DrawerPage title vertical alignment to Center.

* Update DrawerPageDemo.axaml

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

* Update DrawerPageDemo.axaml.cs

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

* fix: fix bottom bar styles.

* fix: update border background color in DrawerPageDemo.axaml.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-30 14:53:38 +08:00
Zhang Dian b0373e9697 chore: enable CPM with single file. (#816)
* chore: enable CPM with single file.

* fix: fix copilot comments.
2026-04-30 14:37:51 +08:00
Copilot d2f789bdbd Add scheduled workflow to auto-remove old CI artifacts (#815)
* Initial plan

* Add workflow to remove old artifacts

Agent-Logs-Url: https://github.com/irihitech/Semi.Avalonia/sessions/ac7e9f88-0a15-4dfe-aae7-64cda4c5ad1e

Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>

* ci: add workflow_dispatch trigger to remove-old-artifacts.yml.

* ci: add remove-old-artifacts.yml to solution file.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2026-04-28 11:10:34 +08:00
Zhang Dian d164acea21 feat: enhance navigation and UI structure in MainView and Application. (#811)
* feat: enhance navigation and UI structure in MainView and Application.

* feat: implement singleton pattern for PaletteDemoViewModel and add initialization check

* feat: set FontWeight to Normal for navigation button in MainView

---------

Co-authored-by: Dong Bin <popmessiah@hotmail.com>
2026-04-24 19:58:27 +08:00
Copilot 1f10fd680f Add git commit message convention under .github (#789) 2026-04-24 14:48:16 +08:00
Dong Bin 480316e2f9 Change indent size for Xaml files from 2 to 4 2026-04-21 16:02:25 +08:00
rabbitism a024d2ca0e chore: fix datagrid version and bump package version 2026-04-18 16:49:25 +08:00
Copilot 18dec50bb5 Bump Avalonia version to 12.0.1 (#805)
Agent-Logs-Url: https://github.com/irihitech/Semi.Avalonia/sessions/ccdc8843-c9ae-4277-89e1-f25308ba3eaf

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
2026-04-18 16:44:43 +08:00
Zhang Dian 6eb871581c misc: replace QR code of community-support. 2026-04-17 12:57:11 +08:00
Zhang Dian 3807090a4b misc: follow .editorconfig from Avalonia. (#798)
* misc: follow .editorconfig from Avalonia.

* fix: remove Avalonia DevAnalyzer preferences.
2026-04-16 17:37:22 +08:00
Zhang Dian 89cdae2d39 Update AutoCompleteBox bindings and clean up project files (#802)
* fix: update ValueMemberBinding syntax for AutoCompleteBox components.

* chore: remove AvaloniaUseCompiledBindingsByDefault property from project files.

* ci: upgrade draft release version.
2026-04-15 17:01:28 +08:00
Zhang Dian 555ecf16d9 Add icons to TabbedPage content and improve layout. (#801)
* fix: add icons to TabbedPage content and improve layout.

* fix: only update Placement=Top/Bottom in TabbedPage.
2026-04-13 22:46:53 +08:00
Zhang Dian 49ee1c12cc fix: fix workflow_call secrets issue. 2026-04-10 14:56:12 +08:00
Zhang Dian 4447475f18 chore: bump ColorPicker & DataGrid version to 12.0.0. 2026-04-08 01:00:05 +08:00
Zhang Dian e53e744d1f Refactor ColorPicker components and improve UI consistency (#795)
* feat: add converters and update bindings in ColorPicker components.

* feat: simplify ColorPicker layout by replacing complex structure with ColorView component.

* feat: remove CornerRadiusToDoubleConverter.

* feat: replace EnumToBoolConverter & ToColorModel with ObjectConverters.Equal.

* feat: set HexInputAlphaPosition to Trailing.

* feat: update ColorView layout and styling for improved UI consistency.

* feat: bind Increment property of ColorSliders to respective TickFrequency and Slider values.

* feat: update ColorView bindings to use new syntax and adjust CornerRadius for improved styling.

* feat: update ColorPicker SelectedIndex Mode to TwoWay.

* feat: sync upstream changes.

* feat: update ColorPicker and ColorView to use SemiColorPalette for improved color selection.

* feat: update ControlTemplate TargetType.

* feat: add AIPurple colors to Palette.

* refactor: display real Hex in HexColorPicker.

* fix: update ColorView bindings to handle null values with a converter.

* refactor: refactor ColorPicker demo.

* refactor: replace RelativeSource bindings with TemplateBinding in ColorView.

* chore: copy ColorView Template to ColorPicker.

* fix: update AlphaEnabled ToggleSwitch content to reflect correct label.

* fix: fix index order in ColorPicker.
2026-04-08 00:55:03 +08:00
96 changed files with 2047 additions and 1329 deletions
+243
View File
@@ -0,0 +1,243 @@
# editorconfig.org
# top-most EditorConfig file
root = true
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# trim_trailing_whitespace = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# prefer var
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true:suggestion
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# private static fields should have s_ prefix
dotnet_naming_rule.private_static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.private_static_fields_should_have_prefix.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_should_have_prefix.style = private_static_prefix_style
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.required_modifiers = static
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
dotnet_naming_style.private_static_prefix_style.required_prefix = s_
dotnet_naming_style.private_static_prefix_style.capitalization = camel_case
# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
# use accessibility modifiers
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
space_within_single_line_array_initializer_braces = true
#Net Analyzer
dotnet_analyzer_diagnostic.category-Performance.severity = none #error - Uncomment when all violations are fixed.
# CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = warning
# CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = warning
# CA1802: Use literals where appropriate
dotnet_diagnostic.CA1802.severity = warning
# CA1813: Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = warning
# CA1815: Override equals and operator equals on value types
dotnet_diagnostic.CA1815.severity = warning
# CA1820: Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = warning
# CA1821: Remove empty finalizers
dotnet_diagnostic.CA1821.severity = warning
# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_code_quality.CA1822.api_surface = private, internal
# CA1823: Avoid unused private fields
dotnet_diagnostic.CA1823.severity = warning
# CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = warning
# CA1826: Use property instead of Linq Enumerable method
dotnet_diagnostic.CA1826.severity = suggestion
# CA1827: Do not use Count/LongCount when Any can be used
dotnet_diagnostic.CA1827.severity = warning
# CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used
dotnet_diagnostic.CA1828.severity = warning
# CA1829: Use Length/Count property instead of Enumerable.Count method
dotnet_diagnostic.CA1829.severity = warning
#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = warning
# CA1851: Possible multiple enumerations of IEnumerable collection
dotnet_diagnostic.CA1851.severity = warning
#CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method
dotnet_diagnostic.CA1854.severity = warning
#CA2211:Non-constant fields should not be visible
dotnet_diagnostic.CA2211.severity = warning
# Wrapping preferences
csharp_wrap_before_ternary_opsigns = false
# Avalonia PublicAnalyzer preferences
dotnet_diagnostic.AVP1000.severity = warning
dotnet_diagnostic.AVP1001.severity = warning
dotnet_diagnostic.AVP1002.severity = warning
dotnet_diagnostic.AVP1010.severity = warning
dotnet_diagnostic.AVP1011.severity = warning
dotnet_diagnostic.AVP1012.severity = warning
dotnet_diagnostic.AVP1013.severity = warning
dotnet_diagnostic.AVP1020.severity = warning
dotnet_diagnostic.AVP1021.severity = warning
dotnet_diagnostic.AVP1022.severity = warning
dotnet_diagnostic.AVP1030.severity = warning
dotnet_diagnostic.AVP1031.severity = warning
dotnet_diagnostic.AVP1032.severity = warning
dotnet_diagnostic.AVP1040.severity = warning
dotnet_diagnostic.AVA2001.severity = warning
# Xaml files
[*.{xaml,axaml}]
indent_size = 4
# DuplicateSetterError
avalonia_xaml_diagnostic.AVLN2203.severity = warning
# StyleInMergedDictionaries
avalonia_xaml_diagnostic.AVLN2204.severity = warning
# RequiredTemplatePartMissing
avalonia_xaml_diagnostic.AVLN2205.severity = warning
# OptionalTemplatePartMissing
avalonia_xaml_diagnostic.AVLN2206.severity = info
# TemplatePartWrongType
avalonia_xaml_diagnostic.AVLN2207.severity = warning
# ItemContainerInsideTemplate
avalonia_xaml_diagnostic.AVLN2208.severity = warning
# Obsolete
avalonia_xaml_diagnostic.AVLN5001.severity = warning
# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
# Xml build files
[*.builds]
indent_size = 2
# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2
# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2
[*.json]
indent_size = 2
[*.{yml,yaml}]
indent_size = 2
# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd,bat}]
end_of_line = crlf
+92
View File
@@ -0,0 +1,92 @@
# Git Commit Message Convention
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.
## Format
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
## Types
| Type | Description |
|------|-------------|
| `feat` | A new feature |
| `fix` | A bug fix |
| `docs` | Documentation only changes |
| `style` | Changes that do not affect the meaning of the code (formatting, missing semicolons, etc.) |
| `refactor` | A code change that neither fixes a bug nor adds a feature |
| `perf` | A code change that improves performance |
| `test` | Adding missing tests or correcting existing tests |
| `build` | Changes that affect the build system or external dependencies |
| `ci` | Changes to CI configuration files and scripts |
| `chore` | Other changes that don't modify source or test files |
| `revert` | Reverts a previous commit |
## Rules
1. **Limit the subject line to 50 characters** (72 character hard limit)
2. **Use the imperative mood** in the subject line (e.g., "add feature" not "added feature")
3. **Do not end the subject line with a period**
4. **Use lowercase** for the description (e.g., "add feature" not "Add feature")
5. **Separate subject from body with a blank line**
6. **Wrap the body at 72 characters**
7. **Use the body to explain what and why**, not how
8. **Reference issues and pull requests** in the footer
## Scope
The scope should be the name of the package or area affected (e.g., `button`, `datepicker`, `theme`, `demo`).
## Examples
### Simple commit
```
feat(button): add loading state support
```
### Commit with body
```
fix(datepicker): correct month navigation overflow
When navigating past December, the month index wrapped to a
negative value instead of rolling over to January of the next year.
```
### Commit with breaking change
```
feat(theme)!: rename SemiColorPrimary to SemiColorBrand
BREAKING CHANGE: The token SemiColorPrimary has been renamed to
SemiColorBrand. Update all references in your custom theme files.
```
### Commit referencing an issue
```
fix(textbox): placeholder not visible in dark mode
Closes #123
```
## Breaking Changes
Breaking changes must be indicated by appending a `!` after the type/scope, or by including a `BREAKING CHANGE:` footer. Both methods may be used together.
## Revert Commits
When reverting a previous commit, use the `revert` type and reference the reverted commit SHA in the footer:
```
revert: feat(button): add loading state support
Revert commit a1b2c3d.
```
+1 -1
View File
@@ -6,7 +6,7 @@ on:
Version_Prefix:
description: 'Version Prefix'
required: true
default: '11.2.999'
default: '12.0.999'
type: string
Semi_Avalonia:
description: 'Pack Semi.Avalonia'
+1
View File
@@ -40,6 +40,7 @@ on:
Semi_Avalonia_TreeDataGrid:
type: boolean
default: true
secrets: {}
jobs:
Pack_to_NuGet:
+115
View File
@@ -35,6 +35,14 @@ on:
description: 'macOS arm64 AOT'
default: false
type: boolean
osx-x64:
description: 'macOS Intel x64'
default: false
type: boolean
osx-x64-aot:
description: 'macOS Intel x64 AOT'
default: false
type: boolean
android-arm64:
description: 'Android arm64'
default: false
@@ -65,6 +73,12 @@ on:
osx-arm64-aot:
type: boolean
default: true
osx-x64:
type: boolean
default: true
osx-x64-aot:
type: boolean
default: true
android-arm64:
type: boolean
default: true
@@ -180,6 +194,33 @@ jobs:
uses: actions/checkout@v6
- name: Publish osx-arm64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Create .app bundle and DMG (create-dmg)
run: |
set -euo pipefail
APP_DIR="bundle/Semi.Avalonia.Demo.app"
MACOS_DIR="${APP_DIR}/Contents/MacOS"
mkdir -p "${MACOS_DIR}"
cp -R publish/. "${MACOS_DIR}/"
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
codesign --force --deep --sign - "${APP_DIR}"
mkdir -p dmg_stage
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
brew install create-dmg
rm -f Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
create-dmg \
--volname "Semi Avalonia Demo" \
--window-pos 200 120 \
--window-size 640 400 \
--icon-size 100 \
--icon "Semi.Avalonia.Demo.app" 175 185 \
--hide-extension "Semi.Avalonia.Demo.app" \
--app-drop-link 455 185 \
--skip-jenkins \
"Semi.Avalonia.Demo.Desktop.osx-arm64.dmg" \
"dmg_stage"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
@@ -188,6 +229,62 @@ jobs:
publish
!publish/*.pdb
- name: Upload macOS DMG
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
path: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
osx-x64:
if: ${{inputs.osx-x64}}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Publish osx-x64
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Create .app bundle and DMG (create-dmg)
run: |
set -euo pipefail
APP_DIR="bundle/Semi.Avalonia.Demo.app"
MACOS_DIR="${APP_DIR}/Contents/MacOS"
mkdir -p "${MACOS_DIR}"
cp -R publish/. "${MACOS_DIR}/"
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
codesign --force --deep --sign - "${APP_DIR}"
mkdir -p dmg_stage
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
brew install create-dmg
rm -f Semi.Avalonia.Demo.Desktop.osx-x64.dmg
create-dmg \
--volname "Semi Avalonia Demo" \
--window-pos 200 120 \
--window-size 640 400 \
--icon-size 100 \
--icon "Semi.Avalonia.Demo.app" 175 185 \
--hide-extension "Semi.Avalonia.Demo.app" \
--app-drop-link 455 185 \
--skip-jenkins \
"Semi.Avalonia.Demo.Desktop.osx-x64.dmg" \
"dmg_stage"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64
path: |
publish
!publish/*.pdb
- name: Upload macOS DMG (Intel)
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
path: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
osx-arm64-aot:
if: ${{inputs.osx-arm64-aot}}
runs-on: macos-latest
@@ -206,6 +303,24 @@ jobs:
publish
!publish/*.pdb
osx-x64-aot:
if: ${{inputs.osx-x64-aot}}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Enable Native AOT in .csproj
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
- name: Publish osx-x64 AOT
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
path: |
publish
!publish/*.pdb
android-arm64:
if: ${{inputs.android-arm64 }}
runs-on: windows-latest
+8 -1
View File
@@ -33,6 +33,7 @@ jobs:
Semi_Avalonia_ColorPicker: ${{ inputs.Semi_Avalonia_ColorPicker }}
Semi_Avalonia_DataGrid: ${{ inputs.Semi_Avalonia_DataGrid }}
Semi_Avalonia_TreeDataGrid: ${{ inputs.Semi_Avalonia_TreeDataGrid }}
secrets: inherit
publish:
uses: ./.github/workflows/publish.yml
@@ -57,12 +58,16 @@ jobs:
zip -rj Semi.Avalonia.Demo.Desktop.osx-arm64.zip Semi.Avalonia.Demo.Desktop.osx-arm64
cd Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT
zip -r ../Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT.zip .
cd "${GITHUB_WORKSPACE}"
zip -rj Semi.Avalonia.Demo.Desktop.osx-x64.zip Semi.Avalonia.Demo.Desktop.osx-x64
cd Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
zip -r ../Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT.zip .
- name: Display structure of zipped files
run: ls -R
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
with:
generate_release_notes: true
@@ -71,3 +76,5 @@ jobs:
nugets/*.nupkg
android-arm64/*.apk
*.zip
Semi.Avalonia.Demo.Desktop.osx-arm64.dmg/Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
Semi.Avalonia.Demo.Desktop.osx-x64.dmg/Semi.Avalonia.Demo.Desktop.osx-x64.dmg
@@ -0,0 +1,25 @@
name: Remove old artifacts
on:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 10
# For private repos
permissions:
actions: write
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '15 days' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
# Optional inputs
skip-tags: true
skip-recent: 5
+26
View File
@@ -0,0 +1,26 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionOverrideEnabled>true</CentralPackageVersionOverrideEnabled>
<AvaloniaVersion>12.0.3</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<!--src-->
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0"/>
<!--demo-->
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2"/>
</ItemGroup>
</Project>
View File
+9 -4
View File
@@ -3,6 +3,7 @@
<Project Path="demo/Semi.Avalonia.Demo.Android/Semi.Avalonia.Demo.Android.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Fonts/Semi.Avalonia.Demo.Fonts.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj"/>
<Project Path="demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj"/>
</Folder>
@@ -12,13 +13,17 @@
<File Path=".github/workflows/pack.yml"/>
<File Path=".github/workflows/publish.yml"/>
<File Path=".github/workflows/release-tag.yml"/>
<File Path=".github/workflows/remove-old-artifacts.yml"/>
</Folder>
<Folder Name="/Solution Items/">
<File Path="Directory.Packages.props"/>
<File Path="global.json"/>
<File Path="NuGet.Config"/>
</Folder>
<Folder Name="/Solution Items/Demo/">
<File Path="demo/Directory.Packages.props"/>
<File Path="demo/global.json"/>
<File Path="demo/Directory.Build.targets"/>
</Folder>
<Folder Name="/Solution Items/Package/">
<File Path="src/Directory.Packages.props"/>
<Folder Name="/Solution Items/Src/">
<File Path="src/Directory.Build.props"/>
</Folder>
<Project Path="src/Semi.Avalonia.ColorPicker/Semi.Avalonia.ColorPicker.csproj"/>
+17
View File
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>12.0.3</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Avalonia" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Android" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Browser" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Desktop" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.iOS" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.LinuxFramebuffer" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Controls.ColorPicker" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Controls.DataGrid" VersionOverride="$(DataGridVersion)"/>
</ItemGroup>
</Project>
-26
View File
@@ -1,26 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
<SkiaSharpVersion>3.119.3-preview.1.1</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.0-beta3"/>
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2"/>
</ItemGroup>
</Project>
@@ -2,6 +2,7 @@
using Android.Runtime;
using Avalonia;
using Avalonia.Android;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Android;
@@ -1,16 +0,0 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Android;
public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Android/Assets#Source Han Sans CN";
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
});
}
@@ -21,7 +21,6 @@
<ItemGroup>
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
@@ -31,5 +30,6 @@
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup>
</Project>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Semi.Avalonia.Demo.Desktop</string>
<key>CFBundleIdentifier</key>
<string>org.avaloniaui.SemiAvaloniaDemo</string>
<key>CFBundleName</key>
<string>Semi Avalonia Demo</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(Version)</string>
<key>CFBundleVersion</key>
<string>$(Version)</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
</dict>
</plist>
+16 -10
View File
@@ -2,8 +2,10 @@
using Avalonia;
using Avalonia.Dialogs;
using Avalonia.Media;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Desktop;
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
sealed class Program
{
@@ -11,24 +13,28 @@ sealed class Program
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.With(new FontManagerOptions
public static void Main(string[] args)
{
FontFallbacks =
[
new FontFallback
var appBuilder = BuildAvaloniaApp();
if (!OperatingSystem.IsLinux())
appBuilder.With(new FontManagerOptions
{
FontFamily = new FontFamily("Microsoft YaHei")
FontFallbacks = [new FontFallback { FontFamily = new FontFamily("Microsoft YaHei") }]
});
appBuilder.StartWithClassicDesktopLifetime(args);
}
]
})
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
{
var appBuilder = AppBuilder.Configure<App>()
.UseManagedSystemDialogs()
.UsePlatformDetect()
.With(new Win32PlatformOptions())
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
.LogToTrace();
if (OperatingSystem.IsLinux()) appBuilder.WithSourceHanSansCNFont();
return appBuilder;
}
}
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Version>1.0.0</Version>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
@@ -28,5 +29,28 @@
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup>
<UsingTask TaskName="ExpandMacOSPlistVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFile ParameterType="System.String" Required="true"/>
<OutputFile ParameterType="System.String" Required="true"/>
<AppVersion ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs"><![CDATA[
var token = "$" + "(Version)";
System.IO.File.WriteAllText(
OutputFile,
System.IO.File.ReadAllText(InputFile).Replace(token, AppVersion));
]]></Code>
</Task>
</UsingTask>
<Target Name="ExpandMacOSInfoPlist" AfterTargets="Publish">
<ExpandMacOSPlistVersion
InputFile="$(MSBuildProjectDirectory)/Info-macOS.plist"
OutputFile="$(PublishDir)Info-macOS.plist"
AppVersion="$(Version)"/>
</Target>
</Project>
+5 -3
View File
@@ -4,8 +4,10 @@ using System.Linq;
using System.Threading;
using Avalonia;
using Avalonia.Dialogs;
using Semi.Avalonia.Demo.Fonts;
namespace Semi.Avalonia.Demo.Drm;
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
sealed class Program
{
@@ -40,7 +42,8 @@ sealed class Program
=> AppBuilder.Configure<App>()
.UseManagedSystemDialogs()
.UsePlatformDetect()
.With(new Win32PlatformOptions())
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
.WithSourceHanSansCNFont()
.LogToTrace();
private static void SilenceConsole()
@@ -50,7 +53,6 @@ sealed class Program
Console.CursorVisible = false;
while (true)
Console.ReadKey(true);
})
{ IsBackground = true }.Start();
}) { IsBackground = true }.Start();
}
}
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
@@ -29,5 +29,6 @@
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup>
</Project>
@@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Fonts;
public static class AvaloniaAppBuilderExtensions
{
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder)
{
const string uri = "avares://Semi.Avalonia.Demo.Fonts/Assets#Source Han Sans CN";
return builder.With(new FontManagerOptions
{
DefaultFamilyName = uri, FontFallbacks = [new FontFallback { FontFamily = new FontFamily(uri) }]
});
}
}
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia"/>
</ItemGroup>
</Project>
@@ -1,16 +0,0 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Web;
public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Web/Assets#Source Han Sans CN";
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = [new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) }]
});
}
+1
View File
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Browser;
using Semi.Avalonia.Demo.Fonts;
[assembly: SupportedOSPlatform("browser")]
@@ -6,17 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Browser"/>
<PackageReference Include="SkiaSharp"/>
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
</ItemGroup>
</Project>
+10
View File
@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
RequestedThemeVariant="Default"
x:DataType="vm:ApplicationViewModel">
<Application.Styles>
<semi:SemiTheme Locale="zh-CN" />
@@ -28,6 +29,15 @@
CommandParameter="{Binding $self.Header}" />
</NativeMenu>
</NativeMenu.Menu>
<NativeDock.Menu>
<NativeMenu>
<NativeMenuItem Header="New Window" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Show Main Window" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Add Dock Menu Item" />
</NativeMenu>
</NativeDock.Menu>
<TrayIcon.Icons>
<TrayIcons>
<TrayIcon
+16 -12
View File
@@ -1,6 +1,6 @@
using System;
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;
@@ -15,22 +15,26 @@ public partial class App : Application
#if DEBUG
this.AttachDeveloperTools();
#endif
this.DataContext = new ApplicationViewModel();
DataContext = new ApplicationViewModel();
if (OperatingSystem.IsLinux())
{
Resources.Add("DefaultFontFamily", null);
}
}
public override void OnFrameworkInitializationCompleted()
{
switch (ApplicationLifetime)
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
case IClassicDesktopStyleApplicationLifetime desktop:
// Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT
// BindingPlugins.DataValidators.RemoveAt(0);
desktop.MainWindow = new MainWindow();
break;
case ISingleViewApplicationLifetime singleView:
singleView.MainView = new MainView();
break;
desktop.MainWindow = new MainWindow { DataContext = new MainViewModel() };
}
else if (ApplicationLifetime is IActivityApplicationLifetime applicationLifetime)
{
applicationLifetime.MainViewFactory = () => new MainView { DataContext = new MainViewModel() };
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
singleViewPlatform.MainView = new MainView { DataContext = new MainViewModel() };
}
this.RegisterFollowSystemTheme();
@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Metadata;
namespace Semi.Avalonia.Demo.Converters;
public class FileIconConverter : IMultiValueConverter
{
[Content] public IDictionary<string, object?> Items { get; } = new Dictionary<string, object?>();
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is bool isDirectory && values[1] is bool isOpen)
{
if (!isDirectory)
{
return Items["file"];
}
return isOpen ? Items["folderOpen"] : Items["folderClosed"];
}
return AvaloniaProperty.UnsetValue;
}
}
@@ -29,40 +29,40 @@
<AutoCompleteBox
PlaceholderText="Please select a State"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Classes="Large"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Classes="Small"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Classes="Bordered"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
IsEnabled="False"
PlaceholderText="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
InnerLeftContent="https://"
InnerRightContent=".com"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<StackPanel Orientation="Horizontal">
<AutoCompleteBox
Width="100"
Classes="Large"
PlaceholderText="Large"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Width="100"
PlaceholderText="Default"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Width="100"
Classes="Small"
PlaceholderText="Small"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
@@ -70,17 +70,17 @@
Width="100"
IsEnabled="False"
PlaceholderText="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Width="100"
Classes="Bordered"
PlaceholderText="Bordered"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
<AutoCompleteBox
Width="100"
Classes="Bordered"
IsEnabled="False"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
ValueMemberBinding="{Binding Name,x:DataType=vm:StateData}" />
</StackPanel>
</StackPanel>
@@ -2,80 +2,90 @@
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
d:DesignWidth="800"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel Spacing="20">
<StackPanel Orientation="Horizontal" Spacing="20">
<ColorView Name="Test" ColorSpectrumShape="Ring" />
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ColorView
Name="SimpleColorViewTest"
HsvColor="hsv(180,80%,70%)"
IsAlphaVisible="True"
Theme="{StaticResource SimpleColorView}" />
<StackPanel>
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker ColorSpectrumShape="Ring">
<ColorPicker.Palette>
<FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box">
<ColorPicker.Palette>
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker
Theme="{DynamicResource HexColorPicker}"
ColorSpectrumShape="Box">
<ColorPicker.Palette>
<semi:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="Use Style to customize button" />
<ColorPicker
Margin="8"
MinWidth="32"
HsvColor="hsv(180,80%,70%)">
<ColorPicker.Content>
<Border
Margin="1"
Background="{Binding $parent[ColorPicker].HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="1" />
</ColorPicker.Content>
<ColorPicker.Styles>
<Style Selector="DropDownButton">
<Setter Property="Padding" Value="0" />
<Style Selector="^ /template/ PathIcon">
<Setter Property="IsVisible" Value="False" />
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<StackPanel.Styles>
<Style Selector="ToggleSwitch">
<Setter Property="OffContent" Value="{Binding $self.OnContent}" />
</Style>
</Style>
</ColorPicker.Styles>
</ColorPicker>
</StackPanel.Styles>
<StackPanel Spacing="8">
<ToggleSwitch Name="AccentColors" OnContent="IsAccentColorsVisible" IsChecked="True" />
<ToggleSwitch Name="AlphaEnabled" OnContent="IsAlphaEnabled" IsChecked="True" />
<ToggleSwitch Name="Alpha" OnContent="IsAlphaVisible" IsChecked="True" />
<ToggleSwitch Name="ColorComponents" OnContent="IsColorComponentsVisible" IsChecked="True" />
<ToggleSwitch Name="ColorModel" OnContent="IsColorModelVisible" IsChecked="True" />
<ToggleSwitch Name="ColorPalette" OnContent="IsColorPaletteVisible" IsChecked="True" />
<ToggleSwitch Name="ColorPreview" OnContent="IsColorPreviewVisible" IsChecked="True" />
<ToggleSwitch Name="ColorSpectrum" OnContent="IsColorSpectrumVisible" IsChecked="True" />
<ToggleSwitch Name="ColorSpectrumSlider" OnContent="IsColorSpectrumSliderVisible" IsChecked="True" />
<ToggleSwitch Name="ComponentSlider" OnContent="IsComponentSliderVisible" IsChecked="True" />
<ToggleSwitch Name="ComponentTextInput" OnContent="IsComponentTextInputVisible" IsChecked="True" />
<ToggleSwitch Name="HexInput" OnContent="IsHexInputVisible" IsChecked="True" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker
Theme="{StaticResource SimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
<ColorPicker
Theme="{StaticResource HexSimpleColorPicker}"
HsvColor="hsv(180,80%,70%)" />
<Separator />
<StackPanel Spacing="8">
<TextBlock>
<Run Text="Color: " />
<Run Text="{Binding #cv.Color,Mode=OneWay}" />
</TextBlock>
<TextBlock>
<Run Text="HsvColor:" />
<Run Text="{Binding #cv.HsvColor,Mode=OneWay}" />
</TextBlock>
</StackPanel>
</StackPanel>
</ScrollViewer>
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<Border.Styles>
<Style Selector=":is(ColorView)">
<Setter Property="IsAccentColorsVisible" Value="{Binding #AccentColors.IsChecked}" />
<Setter Property="IsAlphaEnabled" Value="{Binding #AlphaEnabled.IsChecked}" />
<Setter Property="IsAlphaVisible" Value="{Binding #Alpha.IsChecked}" />
<Setter Property="IsColorComponentsVisible" Value="{Binding #ColorComponents.IsChecked}" />
<Setter Property="IsColorModelVisible" Value="{Binding #ColorModel.IsChecked}" />
<Setter Property="IsColorPaletteVisible" Value="{Binding #ColorPalette.IsChecked}" />
<Setter Property="IsColorPreviewVisible" Value="{Binding #ColorPreview.IsChecked}" />
<Setter Property="IsColorSpectrumVisible" Value="{Binding #ColorSpectrum.IsChecked}" />
<Setter Property="IsColorSpectrumSliderVisible" Value="{Binding #ColorSpectrumSlider.IsChecked}" />
<Setter Property="IsComponentSliderVisible" Value="{Binding #ComponentSlider.IsChecked}" />
<Setter Property="IsComponentTextInputVisible" Value="{Binding #ComponentTextInput.IsChecked}" />
<Setter Property="IsHexInputVisible" Value="{Binding #HexInput.IsChecked}" />
<Setter Property="Color" Value="#39C5BB" />
</Style>
</Border.Styles>
<StackPanel Margin="12" Spacing="12" Orientation="Horizontal">
<StackPanel Spacing="12">
<TextBlock Text="Default Theme" FontWeight="Bold" FontSize="16" />
<ColorView Name="cv" />
<StackPanel Spacing="12" Orientation="Horizontal">
<ColorPicker />
<ColorPicker Theme="{DynamicResource HexColorPicker}" />
</StackPanel>
</StackPanel>
<StackPanel Spacing="12">
<TextBlock Text="SimpleColorPicker" FontWeight="Bold" FontSize="16" />
<ColorView Theme="{DynamicResource SimpleColorView}" />
<StackPanel Spacing="12" Orientation="Horizontal">
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" />
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" />
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</DockPanel>
</UserControl>
@@ -10,45 +10,84 @@
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SemiColorText0}" />
<TextBlock
Theme="{DynamicResource TitleTextBlock}"
Classes="H4"
Text="Configuration" />
<Button Content="Toggle Drawer"
HorizontalAlignment="Stretch"
Click="OnToggleDrawer" />
<Separator />
<CheckBox Name="ToggleDrawerCheck"
Content="Toggle Drawer" />
<CheckBox Name="GestureCheck"
Content="Gesture Enabled"
IsChecked="True"
IsCheckedChanged="OnGestureChanged" />
IsChecked="True" />
<ComboBox SelectionChanged="OnLayoutChanged" >
<ComboBoxItem Content="CompactOverlay" />
<ComboBoxItem Content="CompactInline" />
<ComboBoxItem Content="Split" />
<ComboBoxItem Content="Overlay" />
<TextBlock Text="Behavior" FontSize="12" />
<ComboBox
Name="BehaviorComboBox"
HorizontalAlignment="Stretch"
SelectedIndex="0">
<DrawerBehavior>Auto</DrawerBehavior>
<DrawerBehavior>Flyout</DrawerBehavior>
<DrawerBehavior>Locked</DrawerBehavior>
<DrawerBehavior>Disabled</DrawerBehavior>
</ComboBox>
<Separator />
<TextBlock Text="Layout" FontSize="12" />
<ComboBox
Name="LayoutComboBox"
HorizontalAlignment="Stretch"
SelectedIndex="0">
<DrawerLayoutBehavior>Overlay</DrawerLayoutBehavior>
<DrawerLayoutBehavior>Split</DrawerLayoutBehavior>
<DrawerLayoutBehavior>CompactOverlay</DrawerLayoutBehavior>
<DrawerLayoutBehavior>CompactInline</DrawerLayoutBehavior>
</ComboBox>
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
<TextBlock Name="StatusText"
Text="Drawer: Closed"
Opacity="0.7"
TextWrapping="Wrap" />
<TextBlock Text="Placement" FontSize="12" />
<ComboBox
Name="PlacementComboBox"
HorizontalAlignment="Stretch"
SelectedIndex="0">
<DrawerPlacement>Left</DrawerPlacement>
<DrawerPlacement>Right</DrawerPlacement>
<DrawerPlacement>Top</DrawerPlacement>
<DrawerPlacement>Bottom</DrawerPlacement>
</ComboBox>
<TextBlock Text="Compact Drawer Length" FontSize="12" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Slider Name="CompactDrawerLengthSlider"
Minimum="0" Maximum="250" Value="80"
TickFrequency="1"
IsSnapToTickEnabled="True"
Width="150" />
<TextBlock Text="{Binding #CompactDrawerLengthSlider.Value}" />
</StackPanel>
<TextBlock Text="Drawer Length" FontSize="12" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Slider Name="DrawerLengthSlider"
Minimum="150" Maximum="400" Value="260"
TickFrequency="1"
IsSnapToTickEnabled="True"
Width="150" />
<TextBlock Text="{Binding #DrawerLengthSlider.Value}" />
</StackPanel>
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBorder}" />
<DrawerPage Name="DemoDrawer"
Margin="12"
Header="First Look"
DrawerLayoutBehavior="Overlay"
CompactDrawerLength="80"
DrawerLength="250">
IsOpen="{Binding #ToggleDrawerCheck.IsChecked}"
IsGestureEnabled="{Binding #GestureCheck.IsChecked}"
DrawerBehavior="{Binding #BehaviorComboBox.SelectedItem}"
DrawerLayoutBehavior="{Binding #LayoutComboBox.SelectedItem}"
DrawerPlacement="{Binding #PlacementComboBox.SelectedItem}"
CompactDrawerLength="{Binding #CompactDrawerLengthSlider.Value}"
DrawerLength="{Binding #DrawerLengthSlider.Value}">
<DrawerPage.DrawerHeader>
<TextBlock Text="Menu" Margin="16" FontSize="18" FontWeight="SemiBold" Foreground="{DynamicResource SemiColorPrimary}" />
</DrawerPage.DrawerHeader>
@@ -1,8 +1,6 @@
using System;
using System.Linq;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input.GestureRecognizers;
using Avalonia.Interactivity;
using Avalonia.Layout;
namespace Semi.Avalonia.Demo.Pages;
@@ -15,32 +13,6 @@ public partial class DrawerPageDemo : UserControl
EnableMouseSwipeGesture(DemoDrawer);
}
protected override void OnLoaded(RoutedEventArgs e)
{
base.OnLoaded(e);
DemoDrawer.Opened += OnDrawerStatusChanged;
DemoDrawer.Closed += OnDrawerStatusChanged;
}
protected override void OnUnloaded(RoutedEventArgs e)
{
base.OnUnloaded(e);
DemoDrawer.Opened -= OnDrawerStatusChanged;
DemoDrawer.Closed -= OnDrawerStatusChanged;
}
private void OnDrawerStatusChanged(object? sender, EventArgs e) => UpdateStatus();
private void OnToggleDrawer(object? sender, RoutedEventArgs e)
{
DemoDrawer.IsOpen = !DemoDrawer.IsOpen;
}
private void OnGestureChanged(object? sender, RoutedEventArgs e)
{
DemoDrawer.IsGestureEnabled = GestureCheck.IsChecked == true;
}
private void OnMenuSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (DrawerMenu.SelectedItem is ListBoxItem item)
@@ -62,11 +34,6 @@ public partial class DrawerPageDemo : UserControl
}
}
private void UpdateStatus()
{
StatusText.Text = $"Drawer: {(DemoDrawer.IsOpen ? "Open" : "Closed")}";
}
private static void EnableMouseSwipeGesture(Control control)
{
var recognizer = control.GestureRecognizers
@@ -75,16 +42,4 @@ public partial class DrawerPageDemo : UserControl
recognizer?.IsMouseEnabled = true;
}
private void OnLayoutChanged(object? sender, SelectionChangedEventArgs e)
{
DemoDrawer.DrawerLayoutBehavior = (sender as ComboBox)?.SelectedIndex switch
{
0 => DrawerLayoutBehavior.CompactOverlay,
1 => DrawerLayoutBehavior.CompactInline,
2 => DrawerLayoutBehavior.Split,
3 => DrawerLayoutBehavior.Overlay,
_ => DrawerLayoutBehavior.CompactOverlay
};
}
}
@@ -12,7 +12,7 @@
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16" />
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="13" />
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="14" />
<Button Content="Push Page"
HorizontalAlignment="Stretch"
@@ -26,6 +26,20 @@
<Separator />
<TextBlock Text="Modal Actions" FontWeight="SemiBold" FontSize="14" />
<Button Name="PushModalButton"
Content="Push Modal"
HorizontalAlignment="Stretch"
Click="OnPushModal" />
<Button Name="PopModalButton"
Content="Pop Modal"
HorizontalAlignment="Stretch"
Click="OnPopModal" />
<Button Name="PopAllModalsButton"
Content="Pop All Modals"
HorizontalAlignment="Stretch"
Click="OnPopAllModals" />
<TextBlock Text="Options" FontWeight="SemiBold" FontSize="14" />
<CheckBox Name="HasNavBarCheck"
@@ -35,20 +49,38 @@
<CheckBox Name="HasBackButtonCheck"
Content="Has Back Button"
IsChecked="True"
IsCheckedChanged="OnHasBackButonChanged" />
IsCheckedChanged="OnHasBackButtonChanged" />
<CheckBox Name="HasShadowCheck"
Content="Has Shadow"
IsChecked="True"
IsCheckedChanged="OnHasShadowChanged" />
<CheckBox Name="large" Content="Large" />
<Separator />
<TextBlock Text="Modal Transition" FontWeight="SemiBold" FontSize="14" />
<ComboBox Name="TransitionCombo"
SelectedIndex="0"
HorizontalAlignment="Stretch"
SelectionChanged="OnTransitionChanged">
<ComboBoxItem Content="Slide from Bottom" />
<ComboBoxItem Content="CrossFade" />
<ComboBoxItem Content="None" />
</ComboBox>
<Separator />
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
<TextBlock Name="StatusText"
Text="Depth: 1"
Opacity="0.7"
TextWrapping="Wrap" />
<TextBlock Name="HeaderText"
Text="Current: Home"
Opacity="0.7"
TextWrapping="Wrap" />
<ToggleSwitch Content="Large" Name="large" />
<TextBlock Name="ModalText"
Text="Modals: 0"
TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
@@ -1,3 +1,5 @@
using System;
using Avalonia.Animation;
using Avalonia.Controls;
using Avalonia.Interactivity;
@@ -6,6 +8,7 @@ namespace Semi.Avalonia.Demo.Pages;
public partial class NavigationPageDemo : UserControl
{
private int _pageCount;
private int _modalCount;
public NavigationPageDemo()
{
@@ -15,7 +18,7 @@ public partial class NavigationPageDemo : UserControl
private async void OnLoaded(object? sender, RoutedEventArgs e)
{
await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages.", 0), null);
await DemoNav.PushAsync(NavigationDemoHelper.MakePage("Home", "Welcome!\nUse the buttons to push and pop pages/modals.", 0), null);
UpdateStatus();
}
@@ -42,6 +45,27 @@ public partial class NavigationPageDemo : UserControl
UpdateStatus();
}
private async void OnPushModal(object? sender, RoutedEventArgs e)
{
_modalCount++;
var modal = NavigationDemoHelper.MakePage($"Modal {_modalCount}", "This page was presented modally.\nTap 'Pop Modal' to dismiss.", _modalCount);
await DemoNav.PushModalAsync(modal);
UpdateStatus();
}
private async void OnPopModal(object? sender, RoutedEventArgs e)
{
await DemoNav.PopModalAsync();
UpdateStatus();
}
private async void OnPopAllModals(object? sender, RoutedEventArgs e)
{
await DemoNav.PopAllModalsAsync();
_modalCount = 0;
UpdateStatus();
}
private void OnHasNavBarChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
@@ -50,7 +74,7 @@ public partial class NavigationPageDemo : UserControl
NavigationPage.SetHasNavigationBar(DemoNav.CurrentPage, HasNavBarCheck.IsChecked == true);
}
private void OnHasBackButonChanged(object? sender, RoutedEventArgs e)
private void OnHasBackButtonChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
return;
@@ -58,9 +82,30 @@ public partial class NavigationPageDemo : UserControl
NavigationPage.SetHasBackButton(DemoNav.CurrentPage, HasBackButtonCheck.IsChecked == true);
}
private void OnHasShadowChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
return;
if (DemoNav.CurrentPage != null)
DemoNav.HasShadow = HasShadowCheck.IsChecked == true;
}
private void OnTransitionChanged(object? sender, SelectionChangedEventArgs e)
{
if (DemoNav == null)
return;
DemoNav.ModalTransition = TransitionCombo.SelectedIndex switch
{
1 => new CrossFade(TimeSpan.FromMilliseconds(250)),
2 => null,
_ => new PageSlide(TimeSpan.FromMilliseconds(300), PageSlide.SlideAxis.Vertical)
};
}
private void UpdateStatus()
{
StatusText.Text = $"Depth: {DemoNav.StackDepth}";
HeaderText.Text = $"Current: {DemoNav.CurrentPage?.Header ?? "(none)"}";
ModalText.Text = $"Modals: {DemoNav.ModalStack.Count}";
}
}
@@ -12,15 +12,17 @@ public partial class PaletteDemo : UserControl
public PaletteDemo()
{
InitializeComponent();
this.DataContext = new PaletteDemoViewModel();
this.DataContext = PaletteDemoViewModel.Instance.Value;
}
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
PaletteDemoViewModel? vm = this.DataContext as PaletteDemoViewModel;
if (this.DataContext is PaletteDemoViewModel vm && !vm.IsInitialized)
{
await Dispatcher.UIThread.InvokeAsync(() => { vm?.InitializeResources(); });
}
}
public async Task Copy(object? o)
{
@@ -50,7 +50,7 @@
<TabbedPage Name="DemoTabs"
TabPlacement="Top"
SelectionChanged="OnSelectionChanged">
<ContentPage Header="Home">
<ContentPage Icon="{DynamicResource SemiIconHome}" Header="Home">
<StackPanel Margin="16" Spacing="8">
<TextBlock Text="Home Tab" FontSize="24" FontWeight="Bold" />
<TextBlock Text="Welcome to the Home tab. This is a TabbedPage sample."
@@ -59,14 +59,14 @@
TextWrapping="Wrap" Opacity="0.7" />
</StackPanel>
</ContentPage>
<ContentPage Header="Search">
<ContentPage Icon="{DynamicResource SemiIconSearch}" Header="Search">
<StackPanel Margin="16" Spacing="8">
<TextBlock Text="Search Tab" FontSize="24" FontWeight="Bold" />
<TextBox PlaceholderText="Type to search..." />
<TextBlock Text="Search results will appear here." Opacity="0.7" />
</StackPanel>
</ContentPage>
<ContentPage Header="Settings">
<ContentPage Icon="{DynamicResource SemiIconSetting}" Header="Settings">
<StackPanel Margin="16" Spacing="8">
<TextBlock Text="Settings Tab" FontSize="24" FontWeight="Bold" />
<CheckBox Content="Enable notifications" />
@@ -3,8 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Semi.Avalonia.Demo.Pages.WindowCustomizationsPage"
x:CompileBindings="True">
x:Class="Semi.Avalonia.Demo.Pages.WindowCustomizationsPage">
<StackPanel
Spacing="10"
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
@@ -0,0 +1,353 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Layout;
using Avalonia.Styling;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Semi.Avalonia.Demo.Pages;
namespace Semi.Avalonia.Demo.ViewModels;
public partial class MainViewModel : ObservableObject
{
private readonly Dictionary<string, NavigationItemViewModel> _itemsByTitle = new(StringComparer.Ordinal);
private readonly IReadOnlyList<NavigationSectionViewModel> _allSections;
[ObservableProperty] public partial string? SearchText { get; set; }
public string DocumentationUrl => "https://docs.irihi.tech/semi";
public string RepoUrl => "https://github.com/irihitech/Semi.Avalonia";
public IReadOnlyList<MenuItemViewModel> MenuItems { get; }
public IReadOnlyList<NavigationSectionViewModel> Sections { get; }
public ObservableCollection<NavigationSectionViewModel> FilteredSections { get; } = [];
public bool ShowEmptySearchState => FilteredSections.Count == 0 && !string.IsNullOrWhiteSpace(SearchText);
public ContentPage? CurrentPage => SelectedItem?.Page;
public string SelectedPageTitle => SelectedItem?.Title ?? "Overview";
public NavigationItemViewModel? SelectedItem
{
get;
private set
{
if (ReferenceEquals(field, value))
{
return;
}
var previous = field;
if (SetProperty(ref field, value))
{
previous?.IsSelected = false;
value?.IsSelected = true;
OnPropertyChanged(nameof(CurrentPage));
OnPropertyChanged(nameof(SelectedPageTitle));
}
}
}
public MainViewModel()
{
MenuItems =
[
new MenuItemViewModel
{
Header = "Theme",
Items =
[
new MenuItemViewModel { Header = "Auto", Command = FollowSystemThemeCommand },
new MenuItemViewModel { Header = "Aquatic", Command = SelectThemeCommand, CommandParameter = SemiTheme.Aquatic },
new MenuItemViewModel { Header = "Desert", Command = SelectThemeCommand, CommandParameter = SemiTheme.Desert },
new MenuItemViewModel { Header = "Dusk", Command = SelectThemeCommand, CommandParameter = SemiTheme.Dusk },
new MenuItemViewModel { Header = "NightSky", Command = SelectThemeCommand, CommandParameter = SemiTheme.NightSky },
]
},
new MenuItemViewModel
{
Header = "Locale",
Items =
[
new MenuItemViewModel { Header = "简体中文", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("zh-CN") },
new MenuItemViewModel { Header = "English", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("en-US") },
new MenuItemViewModel { Header = "日本語", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("ja-JP") },
new MenuItemViewModel { Header = "한국어", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("ko-KR") },
new MenuItemViewModel { Header = "English (UK)", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("en-GB") },
new MenuItemViewModel { Header = "Italiano", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("it-IT") },
new MenuItemViewModel { Header = "Italiano (Switzerland)", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("it-CH") },
new MenuItemViewModel { Header = "Nederlands", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("nl-NL") },
new MenuItemViewModel { Header = "Nederlands (Belgium)", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("nl-BE") },
new MenuItemViewModel { 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") },
new MenuItemViewModel { Header = "Polski", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("pl-PL") },
new MenuItemViewModel { Header = "Français", Command = SelectLocaleCommand, CommandParameter = new CultureInfo("fr-FR") },
]
}
];
Sections = _allSections =
[
new NavigationSectionViewModel("Overview",
[
CreateItem("Overview", static () => new Overview()),
CreateItem("About Us", static () => new AboutUs()),
]),
new NavigationSectionViewModel("Resource Browser",
[
CreateItem("Palette", static () => new PaletteDemo()),
CreateItem("HighContrastTheme", static () => new HighContrastDemo()),
CreateItem("Variables", static () => new VariablesDemo()),
CreateItem("Icon", static () => new IconDemo()),
]),
new NavigationSectionViewModel("Separate Pack",
[
CreateItem("ColorPicker", static () => new ColorPickerDemo()),
CreateItem("DataGrid", static () => new DataGridDemo()),
]),
new NavigationSectionViewModel("Basic",
[
CreateItem("TextBlock", static () => new TextBlockDemo()),
CreateItem("SelectableTextBlock", static () => new SelectableTextBlockDemo()),
CreateItem("Border", static () => new BorderDemo()),
CreateItem("PathIcon", static () => new PathIconDemo()),
]),
new NavigationSectionViewModel("Button",
[
CreateItem("Button", static () => new ButtonDemo()),
CreateItem("HyperlinkButton", static () => new HyperlinkButtonDemo()),
CreateItem("CheckBox", static () => new CheckBoxDemo()),
CreateItem("RadioButton", static () => new RadioButtonDemo()),
CreateItem("ToggleSwitch", static () => new ToggleSwitchDemo()),
]),
new NavigationSectionViewModel("Input",
[
CreateItem("TextBox", static () => new TextBoxDemo()),
CreateItem("AutoCompleteBox", static () => new AutoCompleteBoxDemo()),
CreateItem("ComboBox", static () => new ComboBoxDemo()),
CreateItem("ButtonSpinner", static () => new ButtonSpinnerDemo()),
CreateItem("NumericUpDown", static () => new NumericUpDownDemo()),
CreateItem("Slider", static () => new SliderDemo()),
CreateItem("ManagedFileChooser", static () => new ManagedFileChooserDemo()),
]),
new NavigationSectionViewModel("Date/Time",
[
CreateItem("Calendar", static () => new CalendarDemo()),
CreateItem("CalendarDatePicker", static () => new CalendarDatePickerDemo()),
CreateItem("DatePicker", static () => new DatePickerDemo()),
CreateItem("TimePicker", static () => new TimePickerDemo()),
]),
new NavigationSectionViewModel("Navigation",
[
CreateItem("ContentPage", static () => new ContentPageDemo()),
CreateItem("CarouselPage", static () => new CarouselPageDemo()),
CreateItem("DrawerPage", static () => new DrawerPageDemo()),
CreateItem("NavigationPage", static () => new NavigationPageDemo()),
CreateItem("TabbedPage", static () => new TabbedPageDemo()),
CreateItem("TabControl", static () => new TabControlDemo()),
CreateItem("TabStrip", static () => new TabStripDemo()),
CreateItem("TreeView", static () => new TreeViewDemo()),
]),
new NavigationSectionViewModel("Show",
[
CreateItem("Carousel", static () => new CarouselDemo()),
CreateItem("PipsPager", static () => new PipsPagerDemo()),
CreateItem("Expander", static () => new ExpanderDemo()),
CreateItem("Flyout", static () => new FlyoutDemo()),
CreateItem("HeaderedContentControl", static () => new HeaderedContentControlDemo()),
CreateItem("Label", static () => new LabelDemo()),
CreateItem("ListBox", static () => new ListBoxDemo()),
CreateItem("SplitView", static () => new SplitViewDemo()),
CreateItem("ToolTip", static () => new ToolTipDemo()),
]),
new NavigationSectionViewModel("Feedback",
[
CreateItem("DataValidationErrors", static () => new DataValidationErrorsDemo()),
CreateItem("Notification", static () => new NotificationDemo()),
CreateItem("ProgressBar", static () => new ProgressBarDemo()),
CreateItem("RefreshContainer", static () => new RefreshContainerDemo()),
]),
new NavigationSectionViewModel("Other",
[
CreateItem("CommandBar", static () => new CommandBarDemo()),
CreateItem("GridSplitter", static () => new GridSplitterDemo()),
CreateItem("Menu", static () => new MenuDemo()),
CreateItem("ScrollViewer", static () => new ScrollViewerDemo()),
CreateItem("ThemeVariantScope", static () => new ThemeVariantDemo()),
CreateItem("WindowCustomizationsPage", static () => new WindowCustomizationsPage()),
]),
];
SelectedItem = Sections[0].Items[0];
RefreshFilteredSections();
}
public bool TryNavigateTo(string title)
{
if (_itemsByTitle.TryGetValue(title, out var item))
{
SelectedItem = item;
return true;
}
return false;
}
partial void OnSearchTextChanged(string? value)
{
RefreshFilteredSections();
}
[RelayCommand]
private void NavigateTo(object? parameter)
{
if (parameter is NavigationItemViewModel item)
{
SelectedItem = item;
}
}
[RelayCommand]
private void FollowSystemTheme()
{
Application.Current?.RegisterFollowSystemTheme();
}
[RelayCommand]
private void ToggleTheme()
{
var app = Application.Current;
if (app is null) return;
var theme = app.ActualThemeVariant;
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
app.UnregisterFollowSystemTheme();
}
[RelayCommand]
private void SelectTheme(object? obj)
{
var app = Application.Current;
if (app is null) return;
app.RequestedThemeVariant = obj as ThemeVariant;
app.UnregisterFollowSystemTheme();
}
[RelayCommand]
private void SelectLocale(object? obj)
{
var app = Application.Current;
if (app is null) return;
SemiTheme.OverrideLocaleResources(app, obj as CultureInfo);
}
[RelayCommand]
private static async Task OpenUrl(string url)
{
var launcher = ResolveDefaultTopLevel()?.Launcher;
if (launcher is not null)
{
await launcher.LaunchUriAsync(new Uri(url));
}
}
private NavigationItemViewModel CreateItem(string title, Func<Control> contentFactory)
{
var item = new NavigationItemViewModel(title, NavigateToCommand, contentFactory);
_itemsByTitle.Add(title, item);
return item;
}
private void RefreshFilteredSections()
{
var search = string.IsNullOrWhiteSpace(SearchText) ? string.Empty : SearchText.Trim();
FilteredSections.Clear();
foreach (var section in _allSections)
{
if (search.Length == 0 ||
section.Header.Contains(search, StringComparison.InvariantCultureIgnoreCase))
{
FilteredSections.Add(section);
continue;
}
var matchedItems = section.Items
.Where(item => item.Title.Contains(search, StringComparison.InvariantCultureIgnoreCase))
.ToArray();
if (matchedItems.Length > 0)
{
FilteredSections.Add(new NavigationSectionViewModel(section.Header, matchedItems));
}
}
OnPropertyChanged(nameof(ShowEmptySearchState));
}
private static TopLevel? ResolveDefaultTopLevel()
{
return Application.Current?.ApplicationLifetime switch
{
IClassicDesktopStyleApplicationLifetime desktopLifetime => desktopLifetime.MainWindow,
ISingleViewApplicationLifetime singleView => TopLevel.GetTopLevel(singleView.MainView),
_ => null
};
}
}
public class NavigationSectionViewModel
{
public NavigationSectionViewModel(string header, IReadOnlyList<NavigationItemViewModel> items)
{
Header = header;
Items = items;
}
public string Header { get; }
public IReadOnlyList<NavigationItemViewModel> Items { get; }
}
public partial class NavigationItemViewModel : ObservableObject
{
private readonly Func<Control> _contentFactory;
public NavigationItemViewModel(string title, ICommand navigateCommand, Func<Control> contentFactory)
{
Title = title;
NavigateCommand = navigateCommand;
_contentFactory = contentFactory;
}
public string Title { get; }
public ICommand NavigateCommand { get; }
public ContentPage Page => field ??= new ContentPage
{
Header = Title,
Background = null,
HorizontalContentAlignment = HorizontalAlignment.Stretch,
VerticalContentAlignment = VerticalAlignment.Stretch,
Content = _contentFactory()
};
[ObservableProperty] public partial bool IsSelected { get; set; }
}
public class MenuItemViewModel
{
public string? Header { get; set; }
public ICommand? Command { get; set; }
public object? CommandParameter { get; set; }
public IList<MenuItemViewModel>? Items { get; set; }
}
@@ -14,6 +14,8 @@ namespace Semi.Avalonia.Demo.ViewModels;
public partial class PaletteDemoViewModel : ObservableObject
{
public static Lazy<PaletteDemoViewModel> Instance { get; } = new(() => new PaletteDemoViewModel());
public bool IsInitialized { get; private set; }
private readonly string[] _predefinedColorNames =
[
"Red", "Pink", "Purple", "Violet", "Indigo",
@@ -44,6 +46,7 @@ public partial class PaletteDemoViewModel : ObservableObject
InitializePalette();
InitializeFunctionalColors();
InitializeShadows();
IsInitialized = true;
}
private void InitializePalette()
+91 -231
View File
@@ -4,52 +4,110 @@
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:pages="using:Semi.Avalonia.Demo.Pages"
xmlns:views="clr-namespace:Semi.Avalonia.Demo.Views"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
x:DataType="views:MainViewModel"
x:DataType="vm:MainViewModel"
mc:Ignorable="d">
<UserControl.Resources>
<ControlTheme x:Key="CategoryTabItem" TargetType="TabItem">
<Setter Property="IsEnabled" Value="False" />
<Setter Property="Template">
<ControlTemplate TargetType="TabItem">
<TextBlock
Margin="4"
FontSize="12"
FontWeight="Bold"
Text="{TemplateBinding Header}" />
</ControlTemplate>
</Setter>
<Style Selector="^:disabled /template/ TextBlock">
<UserControl.Styles>
<Style Selector="TextBlock.NavSectionHeader">
<Setter Property="Margin" Value="12,10,12,2" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="{DynamicResource SemiColorText1}" />
</Style>
</ControlTheme>
</UserControl.Resources>
<Grid RowDefinitions="Auto, *">
<Border
Grid.Row="0"
<Style Selector="Border.NavItemHost">
<Setter Property="Margin" Value="6,0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="{DynamicResource SemiBorderRadiusSmall}" />
</Style>
<Style Selector="Border.NavItemHost.Selected">
<Setter Property="Background" Value="{DynamicResource SemiColorPrimaryLight}" />
</Style>
<Style Selector="Button.NavItem">
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="12,8" />
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}" />
</Style>
<Style Selector="Button.NavItem.Selected">
<Setter Property="Foreground" Value="{DynamicResource SemiColorPrimary}" />
</Style>
</UserControl.Styles>
<DrawerPage
Name="MainDrawer"
Margin="8"
Padding="12,4"
Theme="{DynamicResource CardBorder}">
<Panel>
Background="Transparent"
Content="{Binding CurrentPage}"
DrawerLayoutBehavior="{OnFormFactor Split, Mobile=Overlay}"
DrawerLength="300"
IsOpen="True">
<DrawerPage.Header>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSwitch
Name="ExpandButton"
Content="{StaticResource SemiIconSidebar}"
Theme="{DynamicResource IconBorderlessToggleSwitch}" />
<SelectableTextBlock
VerticalAlignment="Center"
Classes="H6"
Text="Semi Avalonia"
Theme="{DynamicResource TitleSelectableTextBlock}" />
<SelectableTextBlock VerticalAlignment="Center" Text="/" />
<TextBlock VerticalAlignment="Center" Text="/" />
<SelectableTextBlock
VerticalAlignment="Center"
Classes="Secondary"
Text="{ReflectionBinding #tab.SelectedItem.Header}" />
Text="{Binding SelectedPageTitle}" />
</StackPanel>
</DrawerPage.Header>
<DrawerPage.DrawerHeader>
<TextBox
Margin="8"
Classes="ClearButton"
PlaceholderText="Search demos or sections"
Text="{Binding SearchText}" />
</DrawerPage.DrawerHeader>
<DrawerPage.Drawer>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<StackPanel>
<ItemsControl ItemsSource="{Binding FilteredSections}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:NavigationSectionViewModel">
<StackPanel Margin="0,0,0,10">
<TextBlock Classes="NavSectionHeader" Text="{Binding Header}" />
<ItemsControl ItemsSource="{Binding Items}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:NavigationItemViewModel">
<Border Classes="NavItemHost" Classes.Selected="{Binding IsSelected}">
<Button
Classes="NavItem"
FontWeight="Normal"
Classes.Selected="{Binding IsSelected}"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding}"
Content="{Binding Title}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
Margin="16,12,16,0"
Foreground="{DynamicResource SemiColorText1}"
IsVisible="{Binding ShowEmptySearchState}"
Text="No demo pages matched your search." />
</StackPanel>
</ScrollViewer>
</DrawerPage.Drawer>
<DrawerPage.DrawerFooter>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Command="{Binding OpenUrlCommand}"
@@ -74,7 +132,7 @@
<MenuFlyout ItemsSource="{Binding MenuItems}" Placement="Bottom" />
</Button.Flyout>
<Button.Styles>
<Style x:DataType="views:MenuItemViewModel" Selector="MenuItem">
<Style x:DataType="vm:MenuItemViewModel" Selector="MenuItem">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemsSource" Value="{Binding Items}" />
<Setter Property="Command" Value="{Binding Command}" />
@@ -83,204 +141,6 @@
</Button.Styles>
</Button>
</StackPanel>
</Panel>
</Border>
<TabControl
Name="tab"
Grid.Row="1"
Margin="8"
Padding="20,0,0,0"
Classes.Dismiss="{Binding #ExpandButton.IsChecked}"
TabStripPlacement="Left"
Theme="{DynamicResource ScrollLineTabControl}">
<TabControl.Styles>
<Style Selector=".Dismiss /template/ ScrollViewer#PART_ScrollViewer">
<Setter Property="IsVisible" Value="False" />
</Style>
</TabControl.Styles>
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
<TabItem Header="Overview">
<pages:Overview />
</TabItem>
<TabItem Header="About Us">
<pages:AboutUs />
</TabItem>
<TabItem Header="Resource Browser" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="Palette">
<pages:PaletteDemo />
</TabItem>
<TabItem Header="HighContrastTheme">
<pages:HighContrastDemo />
</TabItem>
<TabItem Header="Variables">
<pages:VariablesDemo />
</TabItem>
<TabItem Header="Icon">
<pages:IconDemo />
</TabItem>
<TabItem Header="Separate Pack" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="ColorPicker">
<pages:ColorPickerDemo />
</TabItem>
<TabItem Header="DataGrid">
<pages:DataGridDemo />
</TabItem>
<!-- <TabItem Header="TreeDataGrid"> -->
<!-- <pages:TreeDataGridDemo /> -->
<!-- </TabItem> -->
<TabItem Header="Basic" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="TextBlock">
<pages:TextBlockDemo />
</TabItem>
<TabItem Header="SelectableTextBlock">
<pages:SelectableTextBlockDemo />
</TabItem>
<TabItem Header="Border">
<pages:BorderDemo />
</TabItem>
<TabItem Header="PathIcon">
<pages:PathIconDemo />
</TabItem>
<TabItem Header="Button" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="Button">
<pages:ButtonDemo />
</TabItem>
<TabItem Header="HyperlinkButton">
<pages:HyperlinkButtonDemo />
</TabItem>
<TabItem Header="CheckBox">
<pages:CheckBoxDemo />
</TabItem>
<TabItem Header="RadioButton">
<pages:RadioButtonDemo />
</TabItem>
<TabItem Header="ToggleSwitch">
<pages:ToggleSwitchDemo />
</TabItem>
<TabItem Header="Input" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="TextBox">
<pages:TextBoxDemo />
</TabItem>
<TabItem Header="AutoCompleteBox">
<pages:AutoCompleteBoxDemo />
</TabItem>
<TabItem Header="ComboBox">
<pages:ComboBoxDemo />
</TabItem>
<TabItem Header="ButtonSpinner">
<pages:ButtonSpinnerDemo />
</TabItem>
<TabItem Header="NumericUpDown">
<pages:NumericUpDownDemo />
</TabItem>
<TabItem Header="Slider">
<pages:SliderDemo />
</TabItem>
<TabItem Header="ManagedFileChooser">
<pages:ManagedFileChooserDemo />
</TabItem>
<TabItem Header="Date/Time" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="Calendar">
<pages:CalendarDemo />
</TabItem>
<TabItem Header="CalendarDatePicker">
<pages:CalendarDatePickerDemo />
</TabItem>
<TabItem Header="DatePicker">
<pages:DatePickerDemo />
</TabItem>
<TabItem Header="TimePicker">
<pages:TimePickerDemo />
</TabItem>
<TabItem Header="Navigation" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="ContentPage">
<pages:ContentPageDemo />
</TabItem>
<TabItem Header="CarouselPage">
<pages:CarouselPageDemo />
</TabItem>
<TabItem Header="DrawerPage">
<pages:DrawerPageDemo />
</TabItem>
<TabItem Header="NavigationPage">
<pages:NavigationPageDemo />
</TabItem>
<TabItem Header="TabbedPage">
<pages:TabbedPageDemo />
</TabItem>
<TabItem Header="TabControl">
<pages:TabControlDemo />
</TabItem>
<TabItem Header="TabStrip">
<pages:TabStripDemo />
</TabItem>
<TabItem Header="TreeView">
<pages:TreeViewDemo />
</TabItem>
<TabItem Header="Show" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="Carousel">
<pages:CarouselDemo />
</TabItem>
<TabItem Header="PipsPager">
<pages:PipsPagerDemo />
</TabItem>
<TabItem Header="Expander">
<pages:ExpanderDemo />
</TabItem>
<TabItem Header="Flyout">
<pages:FlyoutDemo />
</TabItem>
<TabItem Header="HeaderedContentControl">
<pages:HeaderedContentControlDemo />
</TabItem>
<TabItem Header="Label">
<pages:LabelDemo />
</TabItem>
<TabItem Header="ListBox">
<pages:ListBoxDemo />
</TabItem>
<TabItem Header="SplitView">
<pages:SplitViewDemo />
</TabItem>
<TabItem Header="ToolTip">
<pages:ToolTipDemo />
</TabItem>
<TabItem Header="Feedback" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="DataValidationErrors">
<pages:DataValidationErrorsDemo />
</TabItem>
<TabItem Header="Notification">
<pages:NotificationDemo />
</TabItem>
<TabItem Header="ProgressBar">
<pages:ProgressBarDemo />
</TabItem>
<TabItem Header="RefreshContainer">
<pages:RefreshContainerDemo />
</TabItem>
<TabItem Header="Other" Theme="{DynamicResource CategoryTabItem}" />
<TabItem Header="CommandBar">
<pages:CommandBarDemo />
</TabItem>
<TabItem Header="GridSplitter">
<pages:GridSplitterDemo />
</TabItem>
<TabItem Header="Menu">
<pages:MenuDemo />
</TabItem>
<TabItem Header="ScrollViewer">
<pages:ScrollViewerDemo />
</TabItem>
<TabItem Header="ThemeVariantScope">
<pages:ThemeVariantDemo />
</TabItem>
<TabItem Header="WindowCustomizationsPage">
<pages:WindowCustomizationsPage />
</TabItem>
</TabControl>
</Grid>
</DrawerPage.DrawerFooter>
</DrawerPage>
</UserControl>
+5 -233
View File
@@ -1,250 +1,22 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Styling;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Views;
public partial class MainView : UserControl
{
private readonly MainViewModel _viewModel;
public MainView()
{
InitializeComponent();
this.DataContext = new MainViewModel();
DataContext = _viewModel = new MainViewModel();
WeakReferenceMessenger.Default.Register<string, string>(this, "JumpTo", MessageHandler);
}
private void MessageHandler(object _, string message)
{
foreach (var item in tab.ItemsView)
{
if (item is TabItem tabItem && tabItem.Header is not null && tabItem.Header.Equals(message))
{
tab.SelectedItem = tabItem;
break;
_viewModel.TryNavigateTo(message);
}
}
}
}
public partial class MainViewModel : ObservableObject
{
public string DocumentationUrl => "https://docs.irihi.tech/semi";
public string RepoUrl => "https://github.com/irihitech/Semi.Avalonia";
public IReadOnlyList<MenuItemViewModel> MenuItems { get; }
public MainViewModel()
{
MenuItems =
[
new MenuItemViewModel
{
Header = "Theme",
Items =
[
new MenuItemViewModel
{
Header = "Auto",
Command = FollowSystemThemeCommand
},
new MenuItemViewModel
{
Header = "Aquatic",
Command = SelectThemeCommand,
CommandParameter = SemiTheme.Aquatic
},
new MenuItemViewModel
{
Header = "Desert",
Command = SelectThemeCommand,
CommandParameter = SemiTheme.Desert
},
new MenuItemViewModel
{
Header = "Dusk",
Command = SelectThemeCommand,
CommandParameter = SemiTheme.Dusk
},
new MenuItemViewModel
{
Header = "NightSky",
Command = SelectThemeCommand,
CommandParameter = SemiTheme.NightSky
},
]
},
new MenuItemViewModel
{
Header = "Locale",
Items =
[
new MenuItemViewModel
{
Header = "简体中文",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("zh-CN")
},
new MenuItemViewModel
{
Header = "English",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("en-US")
},
new MenuItemViewModel
{
Header = "日本語",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("ja-JP")
},
new MenuItemViewModel
{
Header = "한국어",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("ko-KR")
},
new MenuItemViewModel
{
Header = "English (UK)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("en-GB")
},
new MenuItemViewModel
{
Header = "Italiano",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("it-IT")
},
new MenuItemViewModel
{
Header = "Italiano (Switzerland)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("it-CH")
},
new MenuItemViewModel
{
Header = "Nederlands",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("nl-NL")
},
new MenuItemViewModel
{
Header = "Nederlands (Belgium)",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("nl-BE")
},
new MenuItemViewModel
{
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")
},
new MenuItemViewModel
{
Header = "Polski",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("pl-PL")
},
new MenuItemViewModel
{
Header = "Français",
Command = SelectLocaleCommand,
CommandParameter = new CultureInfo("fr-FR")
},
]
}
];
}
[RelayCommand]
private void FollowSystemTheme()
{
Application.Current?.RegisterFollowSystemTheme();
}
[RelayCommand]
private void ToggleTheme()
{
var app = Application.Current;
if (app is null) return;
var theme = app.ActualThemeVariant;
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
app.UnregisterFollowSystemTheme();
}
[RelayCommand]
private void SelectTheme(object? obj)
{
var app = Application.Current;
if (app is null) return;
app.RequestedThemeVariant = obj as ThemeVariant;
app.UnregisterFollowSystemTheme();
}
[RelayCommand]
private void SelectLocale(object? obj)
{
var app = Application.Current;
if (app is null) return;
SemiTheme.OverrideLocaleResources(app, obj as CultureInfo);
}
[RelayCommand]
private static async Task OpenUrl(string url)
{
var launcher = ResolveDefaultTopLevel()?.Launcher;
if (launcher is not null)
{
await launcher.LaunchUriAsync(new Uri(url));
}
}
private static TopLevel? ResolveDefaultTopLevel()
{
return Application.Current?.ApplicationLifetime switch
{
IClassicDesktopStyleApplicationLifetime desktopLifetime => desktopLifetime.MainWindow,
ISingleViewApplicationLifetime singleView => TopLevel.GetTopLevel(singleView.MainView),
_ => null
};
}
}
public class MenuItemViewModel
{
public string? Header { get; set; }
public ICommand? Command { get; set; }
public object? CommandParameter { get; set; }
public IList<MenuItemViewModel>? Items { get; set; }
}
-5
View File
@@ -1,5 +0,0 @@
{
"sdk": {
"version": "8.0"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"version": "10.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
-1
View File
@@ -2,7 +2,6 @@
<PropertyGroup>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
-14
View File
@@ -1,14 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0"/>
</ItemGroup>
</Project>
@@ -2,38 +2,48 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:ToBrushConverter x:Key="ToBrushConverter" />
xmlns:semi="https://irihi.tech/semi">
<Design.PreviewWith>
<StackPanel Width="500" Height="500">
<ColorPicker Name="cp" Color="#AAAAAAAA" IsAlphaVisible="True" IsAlphaEnabled="True" />
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
<ColorView Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
<Setter Property="MinWidth" Value="64" />
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Padding" Value="0 0 10 0" />
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
<Setter Property="Content">
<Template>
<Panel>
<Border
Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
<Border
Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
</Panel>
</Template>
</Setter>
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<ControlTemplate TargetType="ColorPicker">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -49,7 +59,9 @@
</Style>
</DropDownButton.Styles>
<DropDownButton.Flyout>
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource ColorPickerFlyoutPlacement}">
<Flyout
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource ColorPickerFlyoutPlacement}">
<!--
The following is copy-pasted from the ColorView's control template.
@@ -57,7 +69,6 @@
Note the only changes are resources specific to the ColorPicker.
-->
<Grid
Name="RootGrid"
Width="300"
Height="300"
RowDefinitions="*,Auto">
@@ -81,7 +92,7 @@
Padding="0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
<TabControl.Styles>
<Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" />
@@ -116,11 +127,11 @@
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="True"
IsPerceptive="False"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsAlphaVisible="False"
IsPerceptive="True"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<ColorSpectrum
@@ -129,7 +140,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
@@ -146,14 +157,10 @@
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
@@ -168,13 +175,13 @@
<ListBox
Margin="12"
VerticalAlignment="Stretch"
ItemContainerTheme="{DynamicResource ColorViewPaletteListBoxItemTheme}"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
Theme="{DynamicResource ColorViewPaletteListBoxTheme}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type Color}">
<DataTemplate DataType="Color">
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -205,7 +212,11 @@
Margin="12"
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12"
Tag="{TemplateBinding ColorModel}">
UseLayoutRounding="False">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles>
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
@@ -214,34 +225,6 @@
</Template>
</Setter>
</Style>
<Style Selector="Grid[Tag=Rgba]">
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="R" />
</Style>
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="G" />
</Style>
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="B" />
</Style>
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
<Style Selector="Grid[Tag=Hsva]">
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="H" />
</Style>
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="S" />
</Style>
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="V" />
</Style>
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
</Grid.Styles>
<!-- Top color model & Hex input -->
<Grid
@@ -302,11 +285,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding Minimum, ElementName=Component1Slider}"
Maximum="{Binding #Component1Slider.Maximum}"
Minimum="{Binding #Component1Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
@@ -315,7 +298,7 @@
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -332,11 +315,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding Minimum, ElementName=Component2Slider}"
Maximum="{Binding #Component2Slider.Maximum}"
Minimum="{Binding #Component2Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
@@ -345,7 +328,7 @@
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -362,11 +345,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding Minimum, ElementName=Component3Slider}"
Maximum="{Binding #Component3Slider.Maximum}"
Minimum="{Binding #Component3Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
@@ -375,7 +358,7 @@
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -392,15 +375,15 @@
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
Maximum="{Binding #AlphaComponentSlider.Maximum}"
Minimum="{Binding #AlphaComponentSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=AlphaComponentSlider}">
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentTextInputVisible" />
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
@@ -412,7 +395,7 @@
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -420,8 +403,8 @@
TickFrequency="1">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentSliderVisible" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
@@ -429,11 +412,11 @@
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Margin="12,0,12,12"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid>
@@ -442,9 +425,33 @@
</DropDownButton>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ DropDownButton">
<Setter Property="Padding" Value="0 0 10 0" />
<Style Selector="^[ColorModel=Rgba]">
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="R" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="G" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="B" />
</Style>
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
<Style Selector="^[ColorModel=Hsva]">
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
<Setter Property="Tag" Value="H" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
<Setter Property="Tag" Value="S" />
</Style>
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
<Setter Property="Tag" Value="V" />
</Style>
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
<Setter Property="Tag" Value="A" />
</Style>
</Style>
</ControlTheme>
@@ -452,38 +459,34 @@
x:Key="HexColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker">
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Setter Property="MinWidth" Value="180" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
</ControlTheme>
<Template x:Key="HexColorPickerTemplate">
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
Background="{Binding $parent[ColorPicker].HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="Regular"
Foreground="{DynamicResource TextBlockDefaultForeground}"
Text="{Binding $parent[ColorPicker].Color}" />
Foreground="{DynamicResource TextBlockDefaultForeground}">
<Run Text="#" />
<Run Text="{Binding $parent[ColorPicker].Color, Converter={StaticResource ColorToHexConverter}}" />
</TextBlock>
</Grid>
</Template>
</Setter>
</ControlTheme>
<ControlTheme
x:Key="SimpleColorPicker"
@@ -491,12 +494,13 @@
TargetType="ColorPicker">
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<ControlTemplate TargetType="ColorPicker">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -511,14 +515,16 @@
</Style>
</DropDownButton.Styles>
<DropDownButton.Flyout>
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<Flyout
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<!--
The following is copy-pasted from the ColorView's control template.
It MUST always be kept in sync with the ColorView (which is master).
Note the only changes are resources specific to the ColorPicker.
-->
<Grid Width="280">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
<RowDefinition Height="Auto" />
@@ -534,6 +540,7 @@
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
@@ -584,35 +591,43 @@
CornerRadius="4" />
<Panel
Name="PART_TextBoxPanel"
Width="106"
Width="116"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
MaxLength="8">
<TextBox.Resources>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox
Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
Name="AlphaComponentNumericUpDown"
Width="70"
Width="60"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
CornerRadius="0"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -621,14 +636,21 @@
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox
Name="ColorModelComboBox"
Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<x:String>Hex</x:String>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>
@@ -647,37 +669,8 @@
x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker">
<Setter Property="MinWidth" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="Regular"
Foreground="{DynamicResource TextBlockDefaultForeground}"
Text="{Binding $parent[ColorPicker].Color}" />
</Grid>
</Template>
</Setter>
<Setter Property="MinWidth" Value="180" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
</ControlTheme>
</ResourceDictionary>
@@ -1,15 +1,13 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters">
<pc:AccentColorConverter x:Key="AccentColorConverter" />
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPreviewer}">
<ControlTemplate TargetType="ColorPreviewer">
<Panel>
<!-- Preview color with accents to the left and right -->
<Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}">
@@ -1,9 +1,6 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb">
<Setter Property="Background" Value="Transparent" />
@@ -12,7 +9,7 @@
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
<Setter Property="Template">
<ControlTemplate>
<ControlTemplate TargetType="Thumb">
<Border
Margin="1"
Background="{TemplateBinding Background}"
@@ -30,33 +27,30 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSlider}">
<ControlTemplate TargetType="ColorSlider">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}">
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
VerticalAlignment="Center"
Height="{Binding #PART_Track.Bounds.Height}"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
VerticalAlignment="Center"
Height="{Binding #PART_Track.Bounds.Height}"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Track
Name="PART_Track"
Height="12"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
VerticalAlignment="Center"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
@@ -101,7 +95,7 @@
Width="{TemplateBinding Height}"
Height="{TemplateBinding Height}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
Theme="{DynamicResource ColorSliderThumbTheme}" />
</Track>
</Grid>
</Border>
@@ -114,32 +108,28 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSlider}">
<ControlTemplate TargetType="ColorSlider">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}">
<Rectangle
Width="{Binding #PART_Track.Bounds.Width}"
Height="{Binding #PART_Track.Bounds.Height}"
HorizontalAlignment="Stretch"
<Border
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
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"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Border
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
Width="{Binding #PART_Track.Bounds.Width}"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Track
Name="PART_Track"
Width="12"
HorizontalAlignment="Stretch"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
@@ -185,7 +175,7 @@
Width="{TemplateBinding Width}"
Height="{TemplateBinding Width}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource ColorSliderThumbTheme}" />
Theme="{DynamicResource ColorSliderThumbTheme}" />
</Track>
</Grid>
</Border>
@@ -1,15 +1,11 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorSpectrum}">
<ControlTemplate TargetType="ColorSpectrum">
<Panel
Name="PART_LayoutRoot"
HorizontalAlignment="Stretch"
@@ -25,27 +21,27 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Rectangle
Name="PART_SpectrumOverlayRectangle"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Ellipse
Name="PART_SpectrumEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Ellipse
Name="PART_SpectrumOverlayEllipse"
@@ -53,7 +49,7 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Canvas
Name="PART_InputTarget"
@@ -89,17 +85,17 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
<Ellipse
Name="BorderEllipse"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape,
Converter={StaticResource EnumToBoolConverter},
Converter={x:Static ObjectConverters.Equal},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
</Panel>
</Panel>
@@ -1,28 +1,23 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:globalization="using:System.Globalization"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
<converters:ColorToHexConverter x:Key="ColorToHexConverter" />
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:ToBrushConverter x:Key="ToBrushConverter" />
<cvts:HsvColorToTextConverter x:Key="HsvColorToTextConverter" />
<cvts:ColorToTextConverter x:Key="ColorToTextConverter" />
<cvts:ToColorModel x:Key="ToColorModel" />
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
xmlns:semi="https://irihi.tech/semi">
<Design.PreviewWith>
<StackPanel>
<ColorView
Theme="{StaticResource SimpleColorView}"
SelectedIndex="2"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
<ColorView
Theme="{DynamicResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</StackPanel>
</Design.PreviewWith>
<VisualBrush
@@ -32,16 +27,12 @@
TileMode="Tile">
<VisualBrush.Visual>
<Image Width="8" Height="8">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="Transparent" Geometry="M0,0 L2,0 2,2, 0,2Z" />
<GeometryDrawing Brush="#19808080" Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z" />
<GeometryDrawing Brush="Transparent" Geometry="M0 0H2V2H0Z" />
<GeometryDrawing Brush="#19808080" Geometry="M0 1H2V2H1V0H0Z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</VisualBrush.Visual>
</VisualBrush>
@@ -61,11 +52,11 @@
CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer
Name="PART_ScrollViewer"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
AllowAutoHide="{TemplateBinding ScrollViewer.AllowAutoHide}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsScrollChainingEnabled="{TemplateBinding ScrollViewer.IsScrollChainingEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Margin="{TemplateBinding Padding}"
@@ -82,8 +73,8 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid UseLayoutRounding="False">
<ControlTemplate TargetType="ListBoxItem">
<Panel UseLayoutRounding="False">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
@@ -101,7 +92,7 @@
VerticalAlignment="Stretch"
IsHitTestVisible="False"
StrokeThickness="1" />
</Grid>
</Panel>
</ControlTemplate>
</Setter>
@@ -141,12 +132,14 @@
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="{TemplateBinding FontWeight}"
UseLayoutRounding="False" />
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
<Style Selector="^:checked">
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" />
@@ -168,14 +161,14 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView">
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Width" Value="300" />
<Setter Property="Height" Value="300" />
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
<ControlTemplate TargetType="ColorView">
<Grid RowDefinitions="*,Auto">
<!-- Backgrounds -->
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
@@ -197,7 +190,7 @@
Padding="0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
<TabControl.Styles>
<Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" />
@@ -232,11 +225,11 @@
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="True"
IsPerceptive="False"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsAlphaVisible="False"
IsPerceptive="True"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" />
<ColorSpectrum
@@ -245,7 +238,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
@@ -262,14 +255,10 @@
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
HsvColor="{Binding #ColorSpectrum.HsvColor}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
</Grid>
</TabItem>
@@ -286,11 +275,11 @@
VerticalAlignment="Stretch"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type Color}">
<DataTemplate DataType="Color">
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -322,6 +311,10 @@
ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12"
UseLayoutRounding="False">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles>
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
@@ -390,11 +383,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding Minimum, ElementName=Component1Slider}"
Maximum="{Binding #Component1Slider.Maximum}"
Minimum="{Binding #Component1Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component1Slider}" />
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component1Slider"
Grid.Row="2"
@@ -403,7 +396,7 @@
VerticalAlignment="Center"
ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -420,11 +413,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding Minimum, ElementName=Component2Slider}"
Maximum="{Binding #Component2Slider.Maximum}"
Minimum="{Binding #Component2Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component2Slider}" />
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component2Slider"
Grid.Row="3"
@@ -433,7 +426,7 @@
VerticalAlignment="Center"
ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -450,11 +443,11 @@
AllowSpin="True"
Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding Minimum, ElementName=Component3Slider}"
Maximum="{Binding #Component3Slider.Maximum}"
Minimum="{Binding #Component3Slider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=Component3Slider}" />
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
<ColorSlider
Name="Component3Slider"
Grid.Row="4"
@@ -463,7 +456,7 @@
VerticalAlignment="Center"
ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -480,15 +473,15 @@
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
Maximum="{Binding #AlphaComponentSlider.Maximum}"
Minimum="{Binding #AlphaComponentSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
Value="{Binding Value, ElementName=AlphaComponentSlider}">
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentTextInputVisible" />
</MultiBinding>
</NumericUpDown.IsVisible>
</NumericUpDown>
@@ -500,7 +493,7 @@
VerticalAlignment="Center"
ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
@@ -508,8 +501,8 @@
TickFrequency="1">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsAlphaVisible" />
<TemplateBinding Property="IsComponentSliderVisible" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider>
@@ -517,11 +510,11 @@
</TabItem>
</TabControl>
<!-- Previewer -->
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
<ColorPreviewer
Grid.Row="1"
Margin="12,-5,12,7"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Margin="12,0,12,12"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid>
@@ -558,11 +551,12 @@
</ControlTheme>
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="Width" Value="280" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
<ControlTemplate TargetType="ColorView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
@@ -579,6 +573,7 @@
Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
@@ -602,7 +597,7 @@
Orientation="Horizontal" />
<ColorSlider
x:Name="ColorSpectrumAlphaSlider"
Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
@@ -629,35 +624,43 @@
CornerRadius="4" />
<Panel
Name="PART_TextBoxPanel"
Width="106"
Width="116"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
MaxLength="8">
<TextBox.Resources>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox
Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
CornerRadius="3 0 0 3"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
Name="AlphaComponentNumericUpDown"
Width="70"
Width="60"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
CornerRadius="0"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -666,14 +669,21 @@
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox
Name="ColorModelComboBox"
Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<x:String>Hex</x:String>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>
@@ -0,0 +1,17 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:globalization="using:System.Globalization">
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
<pc:AccentColorConverter x:Key="AccentColorConverter" />
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
<converters:ToBrushConverter x:Key="ToBrushConverter" />
<converters:ColorToHexConverter x:Key="ColorToHexConverter" AlphaPosition="Trailing" IsAlphaVisible="True" />
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
</ResourceDictionary>
@@ -2,6 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Converters.axaml" />
<ResourceInclude Source="ColorPicker.axaml" />
<ResourceInclude Source="ColorPreviewer.axaml" />
<ResourceInclude Source="ColorSlider.axaml" />
@@ -3,19 +3,19 @@ using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class ColorToTextConverter : IValueConverter
public class ColorToTextConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is Color color ? $"{color.R},{color.G},{color.B},{color.A}" : AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');
@@ -3,21 +3,21 @@ using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class HsvColorToTextConverter : IValueConverter
public class HsvColorToTextConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is HsvColor hsvColor
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
: AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');
@@ -1,21 +0,0 @@
using System;
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data.Converters;
namespace Semi.Avalonia.ColorPicker.Converters;
public class ToColorModel : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return parameter is "Hex" && value is "Hex" ||
parameter is "Rgba" && value is ColorModel.Rgba ||
parameter is "Hsva" && value is ColorModel.Hsva;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
@@ -3,6 +3,7 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>
@@ -1,3 +1,5 @@
using Avalonia.Metadata;
[assembly: XmlnsPrefix("https://irihi.tech/semi", "semi")]
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker.Converters")]
@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-rc1</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0-rc1</PackageReleaseNotes>
<Version>12.0.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.3</PackageReleaseNotes>
<Title>Semi.Avalonia.ColorPicker</Title>
</PropertyGroup>
@@ -1,13 +1,12 @@
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker;
public class SemiColorDarkPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorDarkPalette: IColorPalette
Color.FromUInt32(0xFFE6E8EA),
Color.FromUInt32(0xFFF9F9F9),
},
{
//AIPurple
Color.FromUInt32(0xFF3A1770),
Color.FromUInt32(0xFF532394),
Color.FromUInt32(0xFF6F31B8),
Color.FromUInt32(0xFF8D41DB),
Color.FromUInt32(0xFFA744FF),
Color.FromUInt32(0xFFC375FF),
Color.FromUInt32(0xFFD598FF),
Color.FromUInt32(0xFFE5BAFF),
Color.FromUInt32(0xFFF3DDFF),
Color.FromUInt32(0xFFFBF3FF),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[
@@ -1,13 +1,12 @@
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker;
public class SemiColorLightPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorLightPalette: IColorPalette
Color.FromUInt32(0xFF2E3238),
Color.FromUInt32(0xFF1C1F23),
},
{
//AIPurple
Color.FromUInt32(0xFFF8EDFF),
Color.FromUInt32(0xFFF2DAFF),
Color.FromUInt32(0xFFE3B5FF),
Color.FromUInt32(0xFFD191FF),
Color.FromUInt32(0xFFBD6CFF),
Color.FromUInt32(0xFFA647FF),
Color.FromUInt32(0xFF8636DB),
Color.FromUInt32(0xFF6928B8),
Color.FromUInt32(0xFF4E1C94),
Color.FromUInt32(0xFF361270),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[
+1 -2
View File
@@ -1,8 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:collections="using:Avalonia.Collections"
x:CompileBindings="True">
xmlns:collections="using:Avalonia.Collections">
<ControlTheme x:Key="DataGridCellTextBlockTheme" TargetType="TextBlock">
<Setter Property="Margin" Value="{DynamicResource DataGridCellTextBlockDefaultMargin}" />
<Setter Property="VerticalAlignment" Value="Center" />
+1
View File
@@ -3,6 +3,7 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>
@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0-rc1</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0-rc1</PackageReleaseNotes>
<Version>12.0.0</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0</PackageReleaseNotes>
<Title>Semi.Avalonia.DataGrid</Title>
</PropertyGroup>
@@ -1,8 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls.TreeDataGrid"
x:CompileBindings="True">
xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls.TreeDataGrid">
<Design.PreviewWith>
<StackPanel Margin="20">
<TreeDataGridColumnHeader Header="123" />
+41 -57
View File
@@ -20,27 +20,23 @@
<!-- Compact-mode toggle: visible only in CompactOverlay/CompactInline. -->
<ToggleButton
Name="PART_CompactPaneToggle"
DockPanel.Dock="Top"
AutomationProperties.Name="Toggle navigation drawer"
ToolTip.Tip="{DynamicResource STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER}"
Width="{DynamicResource ButtonDefaultHeight}"
Height="{DynamicResource ButtonDefaultHeight}"
HorizontalAlignment="Left"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Top"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
IsVisible="False"
ToolTip.Tip="Toggle navigation drawer">
IsVisible="False">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_CompactPaneIconPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
@@ -49,117 +45,105 @@
</ToggleButton>
<ContentPresenter
Name="PART_DrawerHeader"
DockPanel.Dock="Top"
Background="{TemplateBinding DrawerHeaderBackground}"
Content="{TemplateBinding DrawerHeader}"
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}"
DockPanel.Dock="Top"
IsVisible="{TemplateBinding DrawerHeader,
Converter={x:Static ObjectConverters.IsNotNull}}" />
IsVisible="{TemplateBinding DrawerHeader, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_DrawerFooter"
DockPanel.Dock="Bottom"
Background="{TemplateBinding DrawerFooterBackground}"
Content="{TemplateBinding DrawerFooter}"
ContentTemplate="{TemplateBinding DrawerFooterTemplate}"
DockPanel.Dock="Bottom"
IsVisible="{TemplateBinding DrawerFooter,
Converter={x:Static ObjectConverters.IsNotNull}}" />
IsVisible="{TemplateBinding DrawerFooter, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_DrawerPresenter"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Drawer}"
ContentTemplate="{TemplateBinding DrawerTemplate}" />
</DockPanel>
</SplitView.Pane>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Panel>
<DockPanel Name="PART_ContentDock">
<Border
Name="PART_TopBar"
DockPanel.Dock="Top"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="5"
Background="{DynamicResource DrawerPageTopBarBackground}"
DockPanel.Dock="Top">
<DockPanel HorizontalAlignment="Stretch">
Background="{DynamicResource DrawerPageTopBarBackground}">
<DockPanel>
<ToggleButton
Name="PART_PaneButton"
DockPanel.Dock="Left"
AutomationProperties.Name="Toggle navigation drawer"
ToolTip.Tip="{DynamicResource STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER}"
Width="{DynamicResource ButtonDefaultHeight}"
Height="{DynamicResource ButtonDefaultHeight}"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Left"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
ToolTip.Tip="Toggle navigation drawer">
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_PaneIconPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentControl
<ContentPresenter
Name="PART_TitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
Margin="{DynamicResource DrawerPageTitleMargin}"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontSize="{DynamicResource DrawerPageTitleFontSize}"
FontWeight="{DynamicResource DrawerPageTitleFontWeight}"
IsVisible="{TemplateBinding Header, Converter={x:Static ObjectConverters.IsNotNull}}" />
</DockPanel>
</Border>
<Border
Name="PART_BottomBar"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="5"
Background="{DynamicResource DrawerPageTopBarBackground}"
DockPanel.Dock="Bottom"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Background="{DynamicResource DrawerPageTopBarBackground}"
IsVisible="False">
<DockPanel HorizontalAlignment="Stretch">
<DockPanel>
<ToggleButton
Name="PART_BottomPaneButton"
AutomationProperties.Name="Toggle navigation drawer"
Background="Transparent"
DockPanel.Dock="Left"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
ToolTip.Tip="Toggle navigation drawer">
AutomationProperties.Name="Toggle navigation drawer"
ToolTip.Tip="{DynamicResource STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER}"
Width="{DynamicResource ButtonDefaultHeight}"
Height="{DynamicResource ButtonDefaultHeight}"
Background="Transparent"
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPaneButtonIcon}"
Data="{DynamicResource DrawerPageMenuGlyph}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
Theme="{DynamicResource InnerPathIcon}" />
<ContentPresenter
Name="PART_BottomPaneIconPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding DrawerIcon}"
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentControl
<ContentPresenter
Name="PART_BottomTitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
Margin="{DynamicResource DrawerPageTitleMargin}"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontSize="{DynamicResource DrawerPageTitleFontSize}"
FontWeight="{DynamicResource DrawerPageTitleFontWeight}"
IsVisible="{TemplateBinding Header, Converter={x:Static ObjectConverters.IsNotNull}}" />
</DockPanel>
</Border>
<ContentPresenter
@@ -178,7 +162,7 @@
Background="{TemplateBinding BackdropBrush}"
IsHitTestVisible="False"
IsVisible="False" />
</Grid>
</Panel>
</SplitView>
</ControlTemplate>
</Setter>
@@ -8,6 +8,26 @@
<ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" />
<Setter Property="PageTransition">
<PageSlide Duration="0:0:0.3" Orientation="Horizontal" FillMode="Forward">
<PageSlide.SlideInEasing>
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
</PageSlide.SlideInEasing>
<PageSlide.SlideOutEasing>
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
</PageSlide.SlideOutEasing>
</PageSlide>
</Setter>
<Setter Property="ModalTransition">
<PageSlide Duration="0:0:0.25" Orientation="Vertical" FillMode="Forward">
<PageSlide.SlideInEasing>
<SplineEasing X1="0.16" Y1="1" X2="0.3" Y2="1" />
</PageSlide.SlideInEasing>
<PageSlide.SlideOutEasing>
<SplineEasing X1="0.2" Y1="0.85" X2="0.3" Y2="1" />
</PageSlide.SlideOutEasing>
</PageSlide>
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="NavigationPage">
<Panel ClipToBounds="True">
+1 -2
View File
@@ -1,7 +1,6 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type SplitView}" TargetType="SplitView">
<Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
<Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
+4 -1
View File
@@ -31,7 +31,6 @@
<DockPanel HorizontalSpacing="{DynamicResource TabItemIconHeaderSpacing}">
<ContentPresenter
Name="PART_IconPresenter"
DockPanel.Dock="Left"
Content="{TemplateBinding Icon}"
ContentTemplate="{TemplateBinding IconTemplate}"
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}">
@@ -61,6 +60,10 @@
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="DockPanel.Dock" Value="Left" />
</Style>
<Style Selector="^:selected">
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="FontWeight" Value="{DynamicResource TabItemSelectedFontWeight}" />
+72 -4
View File
@@ -2,7 +2,11 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<TabbedPage Width="400" Height="300" />
<TabbedPage Width="400" Height="800" TabPlacement="Bottom">
<ContentPage Icon="{DynamicResource SemiIconHome}" Header="Home" />
<ContentPage Icon="{DynamicResource SemiIconSearch}" Header="Search" />
<ContentPage Icon="{DynamicResource SemiIconSetting}" Header="Settings" />
</TabbedPage>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type TabbedPage}" TargetType="TabbedPage">
@@ -11,27 +15,91 @@
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource LineTabControl}" />
Theme="{StaticResource LineTabControl}">
<TabControl.ItemContainerTheme>
<ControlTheme
BasedOn="{StaticResource LineTabItem}"
TargetType="TabItem">
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
<Setter Property="TabItem.Margin" Value="0" />
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="DockPanel.Dock" Value="Top" />
</Style>
</Style>
</ControlTheme>
</TabControl.ItemContainerTheme>
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
</TabControl>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="CardTabbedPage" TargetType="TabbedPage">
<Setter Property="Template">
<ControlTemplate TargetType="TabbedPage">
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource CardTabControl}" />
Theme="{StaticResource CardTabControl}">
<TabControl.ItemContainerTheme>
<ControlTheme
BasedOn="{StaticResource CardTabItem}"
TargetType="TabItem">
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
<Setter Property="TabItem.Padding" Value="8" />
<Setter Property="TabItem.Margin" Value="0" />
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="DockPanel.Dock" Value="Top" />
</Style>
</Style>
</ControlTheme>
</TabControl.ItemContainerTheme>
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
</TabControl>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="ButtonTabbedPage" TargetType="TabbedPage">
<Setter Property="Template">
<ControlTemplate TargetType="TabbedPage">
<TabControl
Name="PART_TabControl"
Background="{TemplateBinding Background}"
Theme="{StaticResource ButtonTabControl}" />
Theme="{StaticResource ButtonTabControl}">
<TabControl.ItemContainerTheme>
<ControlTheme
BasedOn="{StaticResource ButtonTabItem}"
TargetType="TabItem">
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
<Setter Property="TabItem.Padding" Value="12" />
<Setter Property="TabItem.Margin" Value="0" />
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="DockPanel.Dock" Value="Top" />
</Style>
</Style>
</ControlTheme>
</TabControl.ItemContainerTheme>
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
</TabControl>
</ControlTemplate>
</Setter>
</ControlTheme>
@@ -46,8 +46,8 @@
<ControlTheme x:Key="{x:Type WindowDrawnDecorations}" TargetType="WindowDrawnDecorations">
<Setter Property="DefaultTitleBarHeight" Value="32" />
<Setter Property="DefaultFrameThickness" Value="1" />
<Setter Property="DefaultShadowThickness" Value="8" />
<Setter Property="DefaultFrameThickness" Value="4" />
<!-- <Setter Property="DefaultShadowThickness" Value="8" /> -->
<Setter Property="Template">
<WindowDrawnDecorationsTemplate>
<WindowDrawnDecorationsContent>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Ausschneiden</x:String>
<x:String x:Key="STRING_MENU_COPY">Kopieren</x:String>
<x:String x:Key="STRING_MENU_PASTE">Einfügen</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Navigationsleiste umschalten</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Dateiname</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Ausgeblendete Elemente anzeigen</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Cut</x:String>
<x:String x:Key="STRING_MENU_COPY">Copy</x:String>
<x:String x:Key="STRING_MENU_PASTE">Paste</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Toggle navigation drawer</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">File name</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Show hidden files</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Cut</x:String>
<x:String x:Key="STRING_MENU_COPY">Copy</x:String>
<x:String x:Key="STRING_MENU_PASTE">Paste</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Toggle navigation drawer</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">File name</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Show hidden files</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Cortar</x:String>
<x:String x:Key="STRING_MENU_COPY">Copiar</x:String>
<x:String x:Key="STRING_MENU_PASTE">Pegar</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Alternar panel de navegación</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Nombre de fichero</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Mostrar ficheros ocultos</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Couper</x:String>
<x:String x:Key="STRING_MENU_COPY">Copier</x:String>
<x:String x:Key="STRING_MENU_PASTE">Coller</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Basculer le volet de navigation</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Nom du fichier</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Afficher les fichiers cachés</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Taglia</x:String>
<x:String x:Key="STRING_MENU_COPY">Copia</x:String>
<x:String x:Key="STRING_MENU_PASTE">Incolla</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Attiva/disattiva riquadro di navigazione</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Nome file</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Mostra file nascosti</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Taglia</x:String>
<x:String x:Key="STRING_MENU_COPY">Copia</x:String>
<x:String x:Key="STRING_MENU_PASTE">Incolla</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Attiva/disattiva riquadro di navigazione</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Nome file</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Mostra file nascosti</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">切り取り</x:String>
<x:String x:Key="STRING_MENU_COPY">コピー</x:String>
<x:String x:Key="STRING_MENU_PASTE">貼り付け</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">ナビゲーション ドロワーを切り替える</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">ファイル名</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">隠しファイルを表示</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">잘라내기</x:String>
<x:String x:Key="STRING_MENU_COPY">복사</x:String>
<x:String x:Key="STRING_MENU_PASTE">붙여넣기</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">탐색 창 전환</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">파일 이름</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">숨긴 파일 표시</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Knippen</x:String>
<x:String x:Key="STRING_MENU_COPY">Kopiëren</x:String>
<x:String x:Key="STRING_MENU_PASTE">Plakken</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Navigatievenster openen of sluiten</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Bestandsnaam</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Toon verborgen bestanden</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Knippen</x:String>
<x:String x:Key="STRING_MENU_COPY">Kopiëren</x:String>
<x:String x:Key="STRING_MENU_PASTE">Plakken</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Navigatievenster openen of sluiten</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Bestandsnaam</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Toon verborgen bestanden</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Wytnij</x:String>
<x:String x:Key="STRING_MENU_COPY">Kopiuj</x:String>
<x:String x:Key="STRING_MENU_PASTE">Wklej</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Przełącz panel nawigacyjny</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Nazwa pliku</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Pokaż ukryte pliki</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Вырезать</x:String>
<x:String x:Key="STRING_MENU_COPY">Копировать</x:String>
<x:String x:Key="STRING_MENU_PASTE">Вставить</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Переключить панель навигации</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Имя файла</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Показать скрытые файлы</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">Вирізати</x:String>
<x:String x:Key="STRING_MENU_COPY">Копіювати</x:String>
<x:String x:Key="STRING_MENU_PASTE">Вставити</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">Перемкнути панель навігації</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Ім'я файлу</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Показати приховані папки</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">剪切</x:String>
<x:String x:Key="STRING_MENU_COPY">复制</x:String>
<x:String x:Key="STRING_MENU_PASTE">粘贴</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">切换导航抽屉</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">文件名</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">显示隐藏文件</x:String>
+2
View File
@@ -14,6 +14,8 @@
<x:String x:Key="STRING_MENU_CUT">剪下</x:String>
<x:String x:Key="STRING_MENU_COPY">複製</x:String>
<x:String x:Key="STRING_MENU_PASTE">貼上</x:String>
<!-- DrawerPage -->
<x:String x:Key="STRING_DRAWERPAGE_TOGGLE_NAVIGATION_DRAWER">切換導覽抽屜</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">檔案名</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">顯示隱藏檔案</x:String>
+2 -2
View File
@@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<Version>12.0.0</Version>
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.0</PackageReleaseNotes>
<Version>12.0.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.3</PackageReleaseNotes>
<Title>Semi.Avalonia</Title>
</PropertyGroup>
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" />
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />
@@ -1,5 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorWindow" />
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorWindowText" />
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorHotlight" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorHotlight" />
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="WindowBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="WindowBorderBrush" ResourceKey="SemiColorBorder" />
<StaticResource x:Key="WindowBorderShadow" ResourceKey="SemiShadowElevated" />
<StaticResource x:Key="TitleBarBackground" ResourceKey="SemiColorBackground0" />
<SolidColorBrush x:Key="TitleBarBackground">Transparent</SolidColorBrush>
<StaticResource x:Key="CaptionButtonPointeroverBackground" ResourceKey="SemiColorFill1" />
<StaticResource x:Key="CaptionButtonPressedBackground" ResourceKey="SemiColorFill2" />
@@ -4,4 +4,8 @@
<!-- DrawerPage pane button -->
<StaticResource x:Key="DrawerPageMenuGlyph" ResourceKey="SemiIconMenu" />
<StaticResource x:Key="DrawerPageTitleFontSize" ResourceKey="SemiFontSizeHeader6" />
<StaticResource x:Key="DrawerPageTitleFontWeight" ResourceKey="SemiFontWeightBold" />
<Thickness x:Key="DrawerPageTitleMargin">8 0 0 0</Thickness>
</ResourceDictionary>