Compare commits

..

3 Commits

182 changed files with 2401 additions and 4149 deletions

View File

@@ -1,243 +0,0 @@
# 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 DevAnalyzer preferences
dotnet_diagnostic.AVADEV2001.severity = warning
# 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 = 2
# 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
# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd,bat}]
end_of_line = crlf

92
.github/COMMIT_CONVENTION.md vendored Normal file
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.
```

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v5
- name: Setup dotnet - name: Setup dotnet
uses: actions/setup-dotnet@v5 uses: actions/setup-dotnet@v5
@@ -32,7 +32,7 @@ jobs:
run: touch $OUTPUT_PATH/.nojekyll run: touch $OUTPUT_PATH/.nojekyll
- name: Commit wwwroot to GitHub Pages - name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4 uses: JamesIves/github-pages-deploy-action@v4.5.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages branch: gh-pages

View File

@@ -31,7 +31,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v5
- name: Get Version - name: Get Version
run: | run: |
@@ -62,7 +62,7 @@ jobs:
run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate
- name: Upload a Build Artifact - name: Upload a Build Artifact
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v4.6.2
with: with:
name: nugets name: nugets
path: nugets path: nugets

View File

@@ -47,7 +47,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v5
- name: Pack Semi.Avalonia - name: Pack Semi.Avalonia
if: ${{ inputs.Semi_Avalonia }} if: ${{ inputs.Semi_Avalonia }}
@@ -70,7 +70,7 @@ jobs:
run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload a Build Artifact - name: Upload a Build Artifact
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v4.6.2
with: with:
name: nugets name: nugets
path: nugets path: nugets

View File

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

View File

@@ -41,7 +41,7 @@ jobs:
needs: [ nuget,publish ] needs: [ nuget,publish ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/download-artifact@v8 - uses: actions/download-artifact@v4.3.0
- name: Display structure of downloaded files - name: Display structure of downloaded files
run: ls -R run: ls -R
@@ -62,7 +62,7 @@ jobs:
run: ls -R run: ls -R
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2.3.2
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
with: with:
generate_release_notes: true generate_release_notes: true

View File

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

View File

@@ -1,12 +1,13 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.0</AvaloniaVersion> <AvaloniaVersion>11.3.11</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion> <DataGridVersion>11.3.11</DataGridVersion>
<SkiaSharpVersion>3.119.3-preview.1.1</SkiaSharpVersion> <SkiaSharpVersion>3.119.1</SkiaSharpVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/> <PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" /> <PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/> <PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" /> <PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
@@ -14,13 +15,13 @@
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" /> <PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/> <PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/> <PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.0-beta3"/>
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)"/> <PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="$(SkiaSharpVersion)"/> <PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2"/> <PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2"/> <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.3.1"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,20 +0,0 @@
using Android.App;
using Android.Runtime;
using Avalonia;
using Avalonia.Android;
namespace Semi.Avalonia.Demo.Android;
[Application]
public class Application : AvaloniaAndroidApplication<App>
{
protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.WithSourceHanSansCNFont();
}
}

View File

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

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net10.0-android</TargetFramework> <TargetFramework>net10.0-android</TargetFramework>
<SupportedOSPlatformVersion>23</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId> <ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId>
<ApplicationVersion>1</ApplicationVersion> <ApplicationVersion>1</ApplicationVersion>
@@ -13,12 +13,6 @@
<RootNamespace>Semi.Avalonia.Demo.Android</RootNamespace> <RootNamespace>Semi.Avalonia.Demo.Android</RootNamespace>
</PropertyGroup> </PropertyGroup>
<!-- Use CoreCLR on Android -->
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<UseMonoRuntime>false</UseMonoRuntime>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/> <AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" /> <AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />

View File

@@ -11,7 +11,7 @@
<semi:SemiPopupAnimations /> <semi:SemiPopupAnimations />
<semi:ColorPickerSemiTheme /> <semi:ColorPickerSemiTheme />
<semi:DataGridSemiTheme /> <semi:DataGridSemiTheme />
<!-- <semi:TreeDataGridSemiTheme /> --> <semi:TreeDataGridSemiTheme />
</Application.Styles> </Application.Styles>
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>

View File

@@ -12,9 +12,6 @@ public partial class App : Application
public override void Initialize() public override void Initialize()
{ {
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);
#if DEBUG
this.AttachDeveloperTools();
#endif
this.DataContext = new ApplicationViewModel(); this.DataContext = new ApplicationViewModel();
} }
@@ -25,7 +22,7 @@ public partial class App : Application
case IClassicDesktopStyleApplicationLifetime desktop: case IClassicDesktopStyleApplicationLifetime desktop:
// Line below is needed to remove Avalonia data validation. // Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT // Without this line you will get duplicate validations from both Avalonia and CT
// BindingPlugins.DataValidators.RemoveAt(0); BindingPlugins.DataValidators.RemoveAt(0);
desktop.MainWindow = new MainWindow(); desktop.MainWindow = new MainWindow();
break; break;
case ISingleViewApplicationLifetime singleView: case ISingleViewApplicationLifetime singleView:

View File

@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input.Platform;
using Avalonia.Media; using Avalonia.Media;
using Semi.Avalonia.Demo.Converters; using Semi.Avalonia.Demo.Converters;

View File

@@ -28,7 +28,7 @@
</StackPanel.Styles> </StackPanel.Styles>
<AutoCompleteBox <AutoCompleteBox
PlaceholderText="Please select a State" Watermark="Please select a State"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
Classes="Large" Classes="Large"
@@ -41,7 +41,7 @@
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
IsEnabled="False" IsEnabled="False"
PlaceholderText="Disabled" Watermark="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
InnerLeftContent="https://" InnerLeftContent="https://"
@@ -52,16 +52,16 @@
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Large" Classes="Large"
PlaceholderText="Large" Watermark="Large"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
PlaceholderText="Default" Watermark="Default"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Small" Classes="Small"
PlaceholderText="Small" Watermark="Small"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
</StackPanel> </StackPanel>
@@ -69,12 +69,12 @@
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
IsEnabled="False" IsEnabled="False"
PlaceholderText="Disabled" Watermark="Disabled"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"
Classes="Bordered" Classes="Bordered"
PlaceholderText="Bordered" Watermark="Bordered"
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" /> ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
<AutoCompleteBox <AutoCompleteBox
Width="100" Width="100"

View File

@@ -35,30 +35,5 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Text="A.S.I.A" /> Text="A.S.I.A" />
</ButtonSpinner> </ButtonSpinner>
<ButtonSpinner
Height="30"
AllowSpin="{Binding #allowSpinCheck.IsChecked}"
BorderThickness="1"
ShowButtonSpinner="{Binding #showSpinCheck.IsChecked}"
Spin="OnSpin"
Theme="{StaticResource SplitButtonSpinner}">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="A.S.I.A" />
</ButtonSpinner>
<ButtonSpinner
Height="30"
AllowSpin="{Binding #allowSpinCheck.IsChecked}"
ButtonSpinnerLocation="Left"
BorderThickness="1"
ShowButtonSpinner="{Binding #showSpinCheck.IsChecked}"
Spin="OnSpin"
Theme="{StaticResource SplitButtonSpinner}">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="A.S.I.A" />
</ButtonSpinner>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@@ -33,6 +33,6 @@
Margin="0,0,0,8" Margin="0,0,0,8"
CustomDateFormatString="ddd, MMM d" CustomDateFormatString="ddd, MMM d"
SelectedDateFormat="Custom" /> SelectedDateFormat="Custom" />
<CalendarDatePicker Margin="0,0,0,8" PlaceholderText="Placeholder" /> <CalendarDatePicker Margin="0,0,0,8" Watermark="Watermark" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@@ -1,69 +0,0 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Semi.Avalonia.Demo.Pages.CarouselPageDemo">
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="220">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SystemControlHighlightAccentBrush}" />
<TextBlock Text="Navigation" FontWeight="SemiBold" FontSize="13" />
<StackPanel Spacing="6">
<Button Content="Previous" Click="OnPrevious" HorizontalAlignment="Stretch" />
<Button Content="Next" Click="OnNext" HorizontalAlignment="Stretch" />
</StackPanel>
<Separator />
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="13" />
<TextBlock Name="StatusText" Text="Page 1 of 3" Opacity="0.7" TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1"
Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
<Border Margin="12"
BorderBrush="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
BorderThickness="1" CornerRadius="6" ClipToBounds="True">
<Panel>
<CarouselPage Name="DemoCarousel"
SelectionChanged="OnSelectionChanged">
<ContentPage Header="Welcome">
<StackPanel Margin="24" Spacing="12"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Welcome" FontSize="28" FontWeight="Bold"
HorizontalAlignment="Center" />
<TextBlock Text="Swipe left or use the buttons to navigate."
TextWrapping="Wrap" Opacity="0.7" TextAlignment="Center" MaxWidth="280" />
</StackPanel>
</ContentPage>
<ContentPage Header="Explore">
<StackPanel Margin="24" Spacing="12"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Explore" FontSize="28" FontWeight="Bold"
HorizontalAlignment="Center" />
<TextBlock Text="CarouselPage supports scroll-based and transition-based navigation modes."
TextWrapping="Wrap" Opacity="0.7" TextAlignment="Center" MaxWidth="280" />
</StackPanel>
</ContentPage>
<ContentPage Header="Get Started">
<StackPanel Margin="24" Spacing="12"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Get Started" FontSize="28" FontWeight="Bold"
HorizontalAlignment="Center" />
<TextBlock Text="Use SelectedIndex to jump to any page, or assign a PageTransition for animated switching."
TextWrapping="Wrap" Opacity="0.7" TextAlignment="Center" MaxWidth="280" />
</StackPanel>
</ContentPage>
</CarouselPage>
<PipsPager HorizontalAlignment="Center"
VerticalAlignment="Bottom" Margin="0,0,0,20"
NumberOfPages="3"
SelectedPageIndex="{Binding #DemoCarousel.SelectedIndex}" />
</Panel>
</Border>
</DockPanel>
</UserControl>

View File

@@ -1,34 +0,0 @@
using System.Collections;
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace Semi.Avalonia.Demo.Pages;
public partial class CarouselPageDemo : UserControl
{
public CarouselPageDemo()
{
InitializeComponent();
}
private void OnPrevious(object? sender, RoutedEventArgs e)
{
if (DemoCarousel.SelectedIndex > 0)
DemoCarousel.SelectedIndex--;
}
private void OnNext(object? sender, RoutedEventArgs e)
{
var pageCount = (DemoCarousel.Pages as IList)?.Count ?? 0;
if (DemoCarousel.SelectedIndex < pageCount - 1)
DemoCarousel.SelectedIndex++;
}
private void OnSelectionChanged(object? sender, PageSelectionChangedEventArgs e)
{
if (StatusText == null)
return;
var pageCount = (DemoCarousel.Pages as IList)?.Count ?? 0;
StatusText.Text = $"Page {DemoCarousel.SelectedIndex + 1} of {pageCount}";
}
}

View File

@@ -2,90 +2,80 @@
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo" x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="1450" d:DesignHeight="1450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<DockPanel> <ScrollViewer>
<ScrollViewer DockPanel.Dock="Right" Width="260"> <StackPanel Spacing="20">
<StackPanel Margin="12" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="20">
<StackPanel.Styles> <ColorView Name="Test" ColorSpectrumShape="Ring" />
<Style Selector="ToggleSwitch"> <ColorView ColorSpectrumShape="Box" />
<Setter Property="OffContent" Value="{Binding $self.OnContent}" /> <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" />
</Style> </Style>
</StackPanel.Styles> </Style>
<StackPanel Spacing="8"> </ColorPicker.Styles>
<ToggleSwitch Name="AccentColors" OnContent="IsAccentColorsVisible" IsChecked="True" /> </ColorPicker>
<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>
<Separator /> <StackPanel Orientation="Horizontal" Spacing="8">
<ColorPicker
<StackPanel Spacing="8"> Theme="{StaticResource SimpleColorPicker}"
<TextBlock> HsvColor="hsv(180,80%,70%)" />
<Run Text="Color: " /> <ColorPicker
<Run Text="{Binding #cv.Color,Mode=OneWay}" /> Theme="{StaticResource HexSimpleColorPicker}"
</TextBlock> HsvColor="hsv(180,80%,70%)" />
<TextBlock>
<Run Text="HsvColor:" />
<Run Text="{Binding #cv.HsvColor,Mode=OneWay}" />
</TextBlock>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer> </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> </UserControl>

View File

@@ -1,94 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.CommandBarDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:collections="clr-namespace:Avalonia.Collections;assembly=Avalonia.Base"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<collections:AvaloniaList x:TypeArguments="CommandBarDefaultLabelPosition" x:Key="LabelPositionList">
<CommandBarDefaultLabelPosition>Bottom</CommandBarDefaultLabelPosition>
<CommandBarDefaultLabelPosition>Collapsed</CommandBarDefaultLabelPosition>
<CommandBarDefaultLabelPosition>Right</CommandBarDefaultLabelPosition>
</collections:AvaloniaList>
<collections:AvaloniaList x:TypeArguments="CommandBarOverflowButtonVisibility" x:Key="VisibilityList">
<CommandBarOverflowButtonVisibility>Auto</CommandBarOverflowButtonVisibility>
<CommandBarOverflowButtonVisibility>Collapsed</CommandBarOverflowButtonVisibility>
<CommandBarOverflowButtonVisibility>Visible</CommandBarOverflowButtonVisibility>
</collections:AvaloniaList>
</UserControl.Resources>
<ScrollViewer>
<StackPanel Spacing="16">
<GroupBox>
<GroupBox.Header>
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
<TextBlock Grid.Row="0" Grid.Column="0" Text="DefaultLabelPosition" VerticalAlignment="Center" />
<ComboBox Grid.Row="0" Grid.Column="1"
Name="lc"
ItemsSource="{DynamicResource LabelPositionList}"
SelectedValue="{x:Static CommandBarDefaultLabelPosition.Bottom}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="OverflowButtonVisibility" VerticalAlignment="Center" />
<ComboBox Grid.Row="1" Grid.Column="1"
Name="btvb"
ItemsSource="{DynamicResource VisibilityList}"
SelectedValue="{x:Static CommandBarOverflowButtonVisibility.Auto}" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="IsDynamicOverflowEnabled" VerticalAlignment="Center" />
<ToggleSwitch Grid.Row="2" Grid.Column="1" Name="idfe" IsChecked="True" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="IsOpen" VerticalAlignment="Center" />
<ToggleSwitch Grid.Row="3" Grid.Column="1" Name="isop" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="IsSticky" VerticalAlignment="Center" />
<ToggleSwitch Grid.Row="4" Grid.Column="1" Name="isst" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="Width" VerticalAlignment="Center" />
<Slider Grid.Row="5" Grid.Column="1" Name="ws" HorizontalAlignment="Left" Width="500" Minimum="0" Maximum="1000" Value="200" />
</Grid>
</GroupBox.Header>
<CommandBar
DefaultLabelPosition="{Binding #lc.SelectedValue}"
OverflowButtonVisibility="{Binding #btvb.SelectedValue}"
IsDynamicOverflowEnabled="{Binding #idfe.IsChecked}"
IsOpen="{Binding #isop.IsChecked}"
IsSticky="{Binding #isst.IsChecked}"
Width="{Binding #ws.Value}">
<CommandBarButton Label="New" Icon="{DynamicResource SemiIconPlus}" />
<CommandBarButton Label="Save" Icon="{DynamicResource SemiIconSave}" />
<CommandBarSeparator />
<CommandBarToggleButton Label="Bold" Icon="{DynamicResource SemiIconBold}" />
<CommandBarToggleButton Label="Italic" Icon="{DynamicResource SemiIconItalic}" />
<CommandBarToggleButton IsChecked="True" IsEnabled="False" Label="Underline" Icon="{DynamicResource SemiIconUnderline}" />
<CommandBarSeparator />
<CommandBarButton Label="Share" Icon="{DynamicResource SemiIconShare}" />
<CommandBarButton Label="Export" Icon="{DynamicResource SemiIconExport}" />
<CommandBarButton Label="Print" Icon="{DynamicResource SemiIconPrint}" />
<CommandBarSeparator />
<CommandBarButton Label="Delete" Icon="{DynamicResource SemiIconDelete}" />
</CommandBar>
</GroupBox>
<!-- With secondary commands (overflow) -->
<GroupBox>
<GroupBox.Header>
<TextBlock Text="CommandBar — With Secondary Commands (overflow)" />
</GroupBox.Header>
<CommandBar>
<CommandBarButton Label="New" Icon="{DynamicResource SemiIconPlus}" />
<CommandBarButton Label="Save" Icon="{DynamicResource SemiIconSave}" />
<CommandBarButton Label="Share" Icon="{DynamicResource SemiIconShare}" />
<CommandBar.SecondaryCommands>
<CommandBarButton Label="Export" Icon="{DynamicResource SemiIconExport}" />
<CommandBarButton Label="Delete" Icon="{DynamicResource SemiIconDelete}" />
</CommandBar.SecondaryCommands>
</CommandBar>
</GroupBox>
</StackPanel>
</ScrollViewer>
</UserControl>

View File

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

View File

@@ -1,54 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.ContentPageDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SemiColorText0}" />
<TextBlock Text="ContentPage is the fundamental page type. It hosts a single piece of content and integrates with NavigationPage, TabbedPage, and CarouselPage. The Header property sets the navigation bar title."
FontSize="12" Opacity="0.7" TextWrapping="Wrap" />
<Separator />
<TextBlock Text="Navigation" FontWeight="SemiBold" />
<Button Content="Push Page" HorizontalAlignment="Stretch" Click="OnPush" />
<Button Content="Pop Page" HorizontalAlignment="Stretch" Click="OnPop" />
<Button Content="Pop to Root" HorizontalAlignment="Stretch" Click="OnPopToRoot" />
<Separator />
<TextBlock Text="Key Properties" FontWeight="SemiBold" />
<TextBlock Text="• Header: nav bar title (string or Control)" FontSize="12" Opacity="0.8" TextWrapping="Wrap" />
<TextBlock Text="• Content: any Avalonia control" FontSize="12" Opacity="0.8" TextWrapping="Wrap" />
<TextBlock Text="• Background: page background brush" FontSize="12" Opacity="0.8" TextWrapping="Wrap" />
<TextBlock Text="• HorizontalContentAlignment" FontSize="12" Opacity="0.8" />
<TextBlock Text="• VerticalContentAlignment" FontSize="12" Opacity="0.8" />
<TextBlock Text="• AutomaticallyApplySafeAreaPadding" FontSize="12" Opacity="0.8" />
<Separator />
<TextBlock Name="StatusText"
Text="Depth: 1 | Current: Root Page"
FontSize="11"
Opacity="0.7" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<NavigationPage Name="DemoNav" />
</Border>
</DockPanel>
</UserControl>

View File

@@ -1,93 +0,0 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Layout;
namespace Semi.Avalonia.Demo.Pages;
public partial class ContentPageDemo : UserControl
{
private static readonly Color[] PageColors =
[
Color.FromRgb(0xE3, 0xF2, 0xFD), // blue
Color.FromRgb(0xF3, 0xE5, 0xF5), // purple
Color.FromRgb(0xE8, 0xF5, 0xE9), // green
Color.FromRgb(0xFF, 0xF8, 0xE1), // amber
Color.FromRgb(0xFB, 0xE9, 0xE7), // deep orange
];
private int _pageCount;
public ContentPageDemo()
{
InitializeComponent();
Loaded += OnLoaded;
}
private async void OnLoaded(object? sender, RoutedEventArgs e)
{
await DemoNav.PushAsync(MakePage("Root Page", "ContentPage inside a NavigationPage.\nUse the options to navigate."));
UpdateStatus();
}
private async void OnPush(object? sender, RoutedEventArgs e)
{
_pageCount++;
await DemoNav.PushAsync(MakePage($"Page {_pageCount}", $"ContentPage #{_pageCount}.\nNavigate back using the back button."));
UpdateStatus();
}
private async void OnPop(object? sender, RoutedEventArgs e)
{
await DemoNav.PopAsync();
UpdateStatus();
}
private async void OnPopToRoot(object? sender, RoutedEventArgs e)
{
await DemoNav.PopToRootAsync();
_pageCount = 0;
UpdateStatus();
}
private void UpdateStatus()
{
StatusText.Text = $"Depth: {DemoNav.StackDepth} | Current: {DemoNav.CurrentPage?.Header}";
}
private ContentPage MakePage(string header, string body) =>
new ContentPage
{
Header = header,
Background = new SolidColorBrush(PageColors[_pageCount % PageColors.Length]),
Content = new StackPanel
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Spacing = 10,
Children =
{
new TextBlock
{
Text = header,
FontSize = 20,
FontWeight = FontWeight.SemiBold,
HorizontalAlignment = HorizontalAlignment.Center,
Foreground = Brushes.Black,
},
new TextBlock
{
Text = body,
FontSize = 13,
Opacity = 0.7,
TextWrapping = TextWrapping.Wrap,
TextAlignment = TextAlignment.Center,
MaxWidth = 260,
Foreground = Brushes.Black,
}
}
},
HorizontalContentAlignment = HorizontalAlignment.Stretch,
VerticalContentAlignment = VerticalAlignment.Stretch
};
}

View File

@@ -1,6 +1,4 @@
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Semi.Avalonia.Demo.ViewModels; using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages; namespace Semi.Avalonia.Demo.Pages;

View File

@@ -1,77 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.DrawerPageDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="700"
d:DesignWidth="800"
mc:Ignorable="d">
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SemiColorText0}" />
<Button Content="Toggle Drawer"
HorizontalAlignment="Stretch"
Click="OnToggleDrawer" />
<Separator />
<CheckBox Name="GestureCheck"
Content="Gesture Enabled"
IsChecked="True"
IsCheckedChanged="OnGestureChanged" />
<ComboBox SelectionChanged="OnLayoutChanged" >
<ComboBoxItem Content="CompactOverlay" />
<ComboBoxItem Content="CompactInline" />
<ComboBoxItem Content="Split" />
<ComboBoxItem Content="Overlay" />
</ComboBox>
<Separator />
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
<TextBlock Name="StatusText"
Text="Drawer: Closed"
Opacity="0.7"
TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<DrawerPage Name="DemoDrawer"
Margin="12"
Header="First Look"
DrawerLayoutBehavior="Overlay"
CompactDrawerLength="80"
DrawerLength="250">
<DrawerPage.DrawerHeader>
<TextBlock Text="Menu" Margin="16" FontSize="18" FontWeight="SemiBold" Foreground="{DynamicResource SemiColorPrimary}" />
</DrawerPage.DrawerHeader>
<DrawerPage.DrawerFooter>
<TextBlock HorizontalAlignment="Center" Text="Powered by IRIHI" Margin="8" />
</DrawerPage.DrawerFooter>
<DrawerPage.Drawer>
<ListBox Name="DrawerMenu" SelectionChanged="OnMenuSelectionChanged">
<ListBoxItem Content="Home" />
<ListBoxItem Content="Settings" />
<ListBoxItem Content="Profile" />
<ListBoxItem Content="About" />
</ListBox>
</DrawerPage.Drawer>
<DrawerPage.Content>
<ContentPage Header="Home">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="8">
<TextBlock Text="Home Page" FontSize="20" FontWeight="SemiBold" HorizontalAlignment="Center" />
<TextBlock Text="Swipe from the left edge or use the hamburger button to open the drawer."
FontSize="13" Opacity="0.7" TextWrapping="Wrap" TextAlignment="Center" MaxWidth="300" />
</StackPanel>
</ContentPage>
</DrawerPage.Content>
</DrawerPage>
</DockPanel>
</UserControl>

View File

@@ -1,90 +0,0 @@
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input.GestureRecognizers;
using Avalonia.Interactivity;
using Avalonia.Layout;
namespace Semi.Avalonia.Demo.Pages;
public partial class DrawerPageDemo : UserControl
{
public DrawerPageDemo()
{
InitializeComponent();
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)
{
DemoDrawer.Content = new ContentPage
{
Header = item.Content?.ToString(),
Content = new TextBlock
{
Text = $"{item.Content} page content",
FontSize = 16,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
},
HorizontalContentAlignment = HorizontalAlignment.Stretch,
VerticalContentAlignment = VerticalAlignment.Stretch
};
DemoDrawer.IsOpen = false;
}
}
private void UpdateStatus()
{
StatusText.Text = $"Drawer: {(DemoDrawer.IsOpen ? "Open" : "Closed")}";
}
private static void EnableMouseSwipeGesture(Control control)
{
var recognizer = control.GestureRecognizers
.OfType<SwipeGestureRecognizer>()
.FirstOrDefault();
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
};
}
}

View File

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

View File

@@ -1,4 +1,4 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -1,6 +1,5 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input.Platform;
using Semi.Avalonia.Demo.ViewModels; using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages; namespace Semi.Avalonia.Demo.Pages;

View File

@@ -16,7 +16,7 @@
Margin="8" Margin="8"
Classes="ClearButton" Classes="ClearButton"
Text="{Binding SearchText}" Text="{Binding SearchText}"
PlaceholderText="Input Icon Name" /> Watermark="Input Icon Name" />
<TabControl <TabControl
Grid.Row="1" Grid.Row="1"

View File

@@ -1,66 +0,0 @@
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Pages;
/// <summary>
/// Shared helpers for ControlCatalog demo pages.
/// </summary>
internal static class NavigationDemoHelper
{
/// <summary>
/// Pastel background brushes cycled by page index.
/// </summary>
internal static readonly IBrush[] PageBrushes =
[
new SolidColorBrush(Color.Parse("#BBDEFB")),
new SolidColorBrush(Color.Parse("#C8E6C9")),
new SolidColorBrush(Color.Parse("#FFE0B2")),
new SolidColorBrush(Color.Parse("#E1BEE7")),
new SolidColorBrush(Color.Parse("#FFCDD2")),
new SolidColorBrush(Color.Parse("#B2EBF2"))
];
internal static IBrush GetPageBrush(int index) =>
PageBrushes[(index % PageBrushes.Length + PageBrushes.Length) % PageBrushes.Length];
/// <summary>
/// Creates a simple demo ContentPage with a centered title and subtitle.
/// </summary>
internal static ContentPage MakePage(string header, string body, int colorIndex) =>
new()
{
Header = header,
Background = GetPageBrush(colorIndex),
Content = new StackPanel
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Spacing = 8,
Children =
{
new TextBlock
{
Text = header,
FontSize = 20,
FontWeight = FontWeight.SemiBold,
HorizontalAlignment = HorizontalAlignment.Center,
Foreground = Brushes.Black,
},
new TextBlock
{
Text = body,
FontSize = 13,
Opacity = 0.7,
TextWrapping = TextWrapping.Wrap,
TextAlignment = TextAlignment.Center,
MaxWidth = 260,
Foreground = Brushes.Black,
}
}
},
HorizontalContentAlignment = HorizontalAlignment.Stretch,
VerticalContentAlignment = VerticalAlignment.Stretch
};
}

View File

@@ -1,68 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.NavigationPageDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="700"
d:DesignWidth="800"
mc:Ignorable="d">
<ScrollViewer>
<DockPanel>
<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" />
<Button Content="Push Page"
HorizontalAlignment="Stretch"
Click="OnPush" />
<Button Content="Pop"
HorizontalAlignment="Stretch"
Click="OnPop" />
<Button Content="Pop to Root"
HorizontalAlignment="Stretch"
Click="OnPopToRoot" />
<Separator />
<TextBlock Text="Options" FontWeight="SemiBold" FontSize="14" />
<CheckBox Name="HasNavBarCheck"
Content="Has Navigation Bar"
IsChecked="True"
IsCheckedChanged="OnHasNavBarChanged" />
<CheckBox Name="HasBackButtonCheck"
Content="Has Back Button"
IsChecked="True"
IsCheckedChanged="OnHasBackButonChanged" />
<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" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<NavigationPage
Name="DemoNav"
Classes.Large="{Binding #large.IsChecked}" />
</Border>
</DockPanel>
</ScrollViewer>
</UserControl>

View File

@@ -1,66 +0,0 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace Semi.Avalonia.Demo.Pages;
public partial class NavigationPageDemo : UserControl
{
private int _pageCount;
public NavigationPageDemo()
{
InitializeComponent();
Loaded += OnLoaded;
}
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);
UpdateStatus();
}
private async void OnPush(object? sender, RoutedEventArgs e)
{
_pageCount++;
var page = NavigationDemoHelper.MakePage($"Page {_pageCount}", $"This is page {_pageCount}.", _pageCount);
NavigationPage.SetHasNavigationBar(page, HasNavBarCheck.IsChecked == true);
NavigationPage.SetHasBackButton(page, HasBackButtonCheck.IsChecked == true);
await DemoNav.PushAsync(page);
UpdateStatus();
}
private async void OnPop(object? sender, RoutedEventArgs e)
{
await DemoNav.PopAsync();
UpdateStatus();
}
private async void OnPopToRoot(object? sender, RoutedEventArgs e)
{
await DemoNav.PopToRootAsync();
_pageCount = 0;
UpdateStatus();
}
private void OnHasNavBarChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
return;
if (DemoNav.CurrentPage != null)
NavigationPage.SetHasNavigationBar(DemoNav.CurrentPage, HasNavBarCheck.IsChecked == true);
}
private void OnHasBackButonChanged(object? sender, RoutedEventArgs e)
{
if (DemoNav == null)
return;
if (DemoNav.CurrentPage != null)
NavigationPage.SetHasBackButton(DemoNav.CurrentPage, HasBackButtonCheck.IsChecked == true);
}
private void UpdateStatus()
{
StatusText.Text = $"Depth: {DemoNav.StackDepth}";
HeaderText.Text = $"Current: {DemoNav.CurrentPage?.Header ?? "(none)"}";
}
}

View File

@@ -28,15 +28,15 @@
<NumericUpDown <NumericUpDown
Width="100" Width="100"
Classes="Large" Classes="Large"
PlaceholderText="Large" Watermark="Large"
ButtonSpinnerLocation="Left" /> ButtonSpinnerLocation="Left" />
<NumericUpDown <NumericUpDown
Width="100" Width="100"
PlaceholderText="Default" Watermark="Default"
ShowButtonSpinner="False" /> ShowButtonSpinner="False" />
<NumericUpDown <NumericUpDown
Width="100" Width="100"
PlaceholderText="Small" Watermark="Small"
Classes="Small" /> Classes="Small" />
</StackPanel> </StackPanel>
@@ -52,10 +52,5 @@
<NumericUpDown Width="100" ButtonSpinnerLocation="Left" /> <NumericUpDown Width="100" ButtonSpinnerLocation="Left" />
</StackPanel> </StackPanel>
<StackPanel>
<TextBlock Text="Split" />
<NumericUpDown Classes="Split" Width="300" />
</StackPanel>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

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

View File

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

View File

@@ -1,99 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.PipsPagerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel HorizontalAlignment="Left" Spacing="16" Margin="0,0,0,20">
<!-- Horizontal PipsPager -->
<TextBlock Classes="H6" Text="Horizontal" />
<PipsPager
NumberOfPages="8"
Orientation="Horizontal" />
<!-- Vertical PipsPager -->
<TextBlock Classes="H6" Text="Vertical" />
<PipsPager
NumberOfPages="8"
Orientation="Vertical" />
<!-- Linked with Carousel -->
<TextBlock Classes="H6" Text="Linked with Carousel" />
<Panel>
<Carousel
Name="DemoCarousel"
Height="160">
<Border Background="#EAF5FF">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#1C1F23"
Text="Page 1" />
</Border>
<Border Background="#F9F9F9">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#1C1F23"
Text="Page 2" />
</Border>
<Border Background="#FFF8EA">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#1C1F23"
Text="Page 3" />
</Border>
<Border Background="#FEF2ED">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#1C1F23"
Text="Page 4" />
</Border>
<Border Background="#F0F5FF">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#1C1F23"
Text="Page 5" />
</Border>
</Carousel>
<ThemeVariantScope RequestedThemeVariant="Light">
<PipsPager
Name="LinkedPager"
NumberOfPages="5"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0,0,0,8"
SelectedPageIndex="{Binding #DemoCarousel.SelectedIndex}" />
</ThemeVariantScope>
</Panel>
<!-- Various page counts -->
<TextBlock Classes="H6" Text="Various Page Counts" />
<StackPanel Spacing="12">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock VerticalAlignment="Center" Width="80" Text="3 pages" />
<PipsPager NumberOfPages="3" Orientation="Horizontal" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock VerticalAlignment="Center" Width="80" Text="5 pages" />
<PipsPager NumberOfPages="5" Orientation="Horizontal" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock VerticalAlignment="Center" Width="80" Text="10 pages" />
<PipsPager NumberOfPages="10" Orientation="Horizontal" />
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>

View File

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

View File

@@ -34,10 +34,14 @@
</StackPanel> </StackPanel>
<Border MinHeight="150" Theme="{StaticResource CardBorder}"> <Border MinHeight="150" Theme="{StaticResource CardBorder}">
<TabControl Classes.ReverseSeparator="{Binding #reverse.IsChecked}" TabStripPlacement="{Binding #place.SelectedValue}"> <TabControl Classes.ReverseSeparator="{Binding #reverse.IsChecked}" TabStripPlacement="{Binding #place.SelectedValue}">
<TabItem Content="Hello 1" Header="文档" Icon="{StaticResource SemiIconFile}" /> <TabItem Content="Hello 1" Header="Tab 1" />
<TabItem Content="Hello 2" Header="快速起步" Icon="{StaticResource SemiIconGlobe}" /> <TabItem Content="Hello 2" Header="Tab 2" />
<TabItem Content="Hello 4" Header="无效" Icon="{StaticResource SemiIconClear}" IsEnabled="False" /> <TabItem Content="Hello 3" Header="Tab 3" />
<TabItem Content="Hello 3" Header="帮助" Icon="{StaticResource SemiIconHelpCircle}" /> <TabItem Content="中文内容" Header="中文中文" />
<TabItem
Content="Hello 4"
Header="Tab 4"
IsEnabled="False" />
</TabControl> </TabControl>
</Border> </Border>
<Border Height="300" Theme="{StaticResource CardBorder}"> <Border Height="300" Theme="{StaticResource CardBorder}">
@@ -53,10 +57,14 @@
<StackPanel> <StackPanel>
<Border MinHeight="150" Theme="{StaticResource CardBorder}"> <Border MinHeight="150" Theme="{StaticResource CardBorder}">
<TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource LineTabControl}"> <TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource LineTabControl}">
<TabItem Content="Hello 1" Header="文档" Icon="{StaticResource SemiIconFile}" /> <TabItem Content="Hello 1" Header="Tab 1" />
<TabItem Content="Hello 2" Header="快速起步" Icon="{StaticResource SemiIconGlobe}" /> <TabItem Content="Hello 2" Header="Tab 2" />
<TabItem Content="Hello 4" Header="无效" Icon="{StaticResource SemiIconClear}" IsEnabled="False" /> <TabItem Content="Hello 3" Header="Tab 3" />
<TabItem Content="Hello 3" Header="帮助" Icon="{StaticResource SemiIconHelpCircle}" /> <TabItem Content="中文内容" Header="中文中文" />
<TabItem
Content="Hello 4"
Header="Tab 4"
IsEnabled="False" />
</TabControl> </TabControl>
</Border> </Border>
<Border Height="300" Theme="{StaticResource CardBorder}"> <Border Height="300" Theme="{StaticResource CardBorder}">
@@ -74,10 +82,14 @@
Background="Transparent" Background="Transparent"
Theme="{StaticResource CardBorder}"> Theme="{StaticResource CardBorder}">
<TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource CardTabControl}"> <TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource CardTabControl}">
<TabItem Content="Hello 1" Header="文档" Icon="{StaticResource SemiIconFile}" /> <TabItem Content="Hello 1" Header="Tab 1" />
<TabItem Content="Hello 2" Header="快速起步" Icon="{StaticResource SemiIconGlobe}" /> <TabItem Content="Hello 2" Header="Tab 2" />
<TabItem Content="Hello 4" Header="无效" Icon="{StaticResource SemiIconClear}" IsEnabled="False" /> <TabItem Content="Hello 3" Header="Tab 3" />
<TabItem Content="Hello 3" Header="帮助" Icon="{StaticResource SemiIconHelpCircle}" /> <TabItem Content="中文内容" Header="中文中文" />
<TabItem
Content="Hello 4"
Header="Tab 4"
IsEnabled="False" />
</TabControl> </TabControl>
</Border> </Border>
<Border <Border
@@ -95,10 +107,14 @@
<StackPanel> <StackPanel>
<Border MinHeight="150" Theme="{StaticResource CardBorder}"> <Border MinHeight="150" Theme="{StaticResource CardBorder}">
<TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource ButtonTabControl}"> <TabControl TabStripPlacement="{Binding #place.SelectedValue}" Theme="{StaticResource ButtonTabControl}">
<TabItem Content="Hello 1" Header="文档" Icon="{StaticResource SemiIconFile}" /> <TabItem Content="Hello 1" Header="Tab 1" />
<TabItem Content="Hello 2" Header="快速起步" Icon="{StaticResource SemiIconGlobe}" /> <TabItem Content="Hello 2" Header="Tab 2" />
<TabItem Content="Hello 4" Header="无效" Icon="{StaticResource SemiIconClear}" IsEnabled="False" /> <TabItem Content="Hello 3" Header="Tab 3" />
<TabItem Content="Hello 3" Header="帮助" Icon="{StaticResource SemiIconHelpCircle}" /> <TabItem Content="中文内容" Header="中文中文" />
<TabItem
Content="Hello 4"
Header="Tab 4"
IsEnabled="False" />
</TabControl> </TabControl>
</Border> </Border>
<Border Height="300" Theme="{StaticResource CardBorder}"> <Border Height="300" Theme="{StaticResource CardBorder}">

View File

@@ -1,80 +0,0 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.TabbedPageDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SemiColorText0}" />
<TextBlock Text="Tab Management" FontWeight="SemiBold" FontSize="13" />
<StackPanel Spacing="6">
<Button Content="Add Tab" Click="OnAddTab" HorizontalAlignment="Stretch" />
<Button Content="Remove Latest Tab" Click="OnRemoveTab" HorizontalAlignment="Stretch" />
</StackPanel>
<Separator />
<TextBlock Text="Tab Placement" FontWeight="SemiBold" FontSize="13" />
<ComboBox Name="PlacementCombo" SelectedIndex="0"
SelectionChanged="OnPlacementChanged" HorizontalAlignment="Stretch">
<ComboBoxItem Content="Top" />
<ComboBoxItem Content="Bottom" />
<ComboBoxItem Content="Left" />
<ComboBoxItem Content="Right" />
</ComboBox>
<Separator />
<TextBlock Text="Status" FontWeight="SemiBold" FontSize="14" />
<TextBlock Name="StatusText"
Text="3 tabs | Selected: Home (0)"
Opacity="0.7"
TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SemiColorBackground0}" />
<Border Margin="12"
BorderBrush="{DynamicResource SemiColorBorder}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<TabbedPage Name="DemoTabs"
TabPlacement="Top"
SelectionChanged="OnSelectionChanged">
<ContentPage 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."
TextWrapping="Wrap" />
<TextBlock Text="Use the panel on the right to add or remove tabs dynamically."
TextWrapping="Wrap" Opacity="0.7" />
</StackPanel>
</ContentPage>
<ContentPage 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">
<StackPanel Margin="16" Spacing="8">
<TextBlock Text="Settings Tab" FontSize="24" FontWeight="Bold" />
<CheckBox Content="Enable notifications" />
<CheckBox Content="Dark mode" />
<CheckBox Content="Auto-save" IsChecked="True" />
</StackPanel>
</ContentPage>
</TabbedPage>
</Border>
</DockPanel>
</UserControl>

View File

@@ -1,84 +0,0 @@
using System.Collections;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Pages;
public partial class TabbedPageDemo : UserControl
{
private int _tabCounter = 3;
public TabbedPageDemo()
{
InitializeComponent();
}
private void OnAddTab(object? sender, RoutedEventArgs e)
{
var idx = ++_tabCounter;
var page = new ContentPage
{
Header = $"Tab {idx}",
Content = new StackPanel
{
Margin = new Thickness(16),
Spacing = 8,
Children =
{
new TextBlock
{
Text = $"Tab {idx}",
FontSize = 24,
FontWeight = FontWeight.Bold,
},
new TextBlock
{
Text = $"This tab was added dynamically (tab #{idx}).",
Opacity = 0.7,
TextWrapping = TextWrapping.Wrap,
}
}
}
};
((IList)DemoTabs.Pages!).Add(page);
UpdateStatus();
}
private void OnRemoveTab(object? sender, RoutedEventArgs e)
{
var pages = (IList)DemoTabs.Pages!;
if (pages.Count > 1)
{
pages.RemoveAt(pages.Count - 1);
UpdateStatus();
}
}
private void OnPlacementChanged(object? sender, SelectionChangedEventArgs e)
{
if (DemoTabs == null) return;
DemoTabs.TabPlacement = PlacementCombo.SelectedIndex switch
{
1 => TabPlacement.Bottom,
2 => TabPlacement.Left,
3 => TabPlacement.Right,
_ => TabPlacement.Top
};
}
private void OnSelectionChanged(object? sender, PageSelectionChangedEventArgs e)
{
UpdateStatus();
}
private void UpdateStatus()
{
if (StatusText == null) return;
var pages = (IList)DemoTabs.Pages!;
var pageName = (DemoTabs.SelectedPage as ContentPage)?.Header?.ToString() ?? "—";
StatusText.Text = $"{pages.Count} tab{(pages.Count != 1 ? "s" : "")} | Selected: {pageName} ({DemoTabs.SelectedIndex})";
}
}

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -17,7 +17,7 @@
Margin="8" Margin="8"
Classes="ClearButton" Classes="ClearButton"
Text="{Binding SearchText}" Text="{Binding SearchText}"
PlaceholderText="Input Variable Category/ResourceKey/Type/Value/Description" /> Watermark="Input Variable Category/ResourceKey/Type/Value/Description" />
<DataGrid <DataGrid
Grid.Row="1" Grid.Row="1"
@@ -86,7 +86,8 @@
<DataGridTemplateColumn <DataGridTemplateColumn
Width="100" Width="100"
x:DataType="vm:VariableItem" x:DataType="vm:VariableItem"
Header="CopyText"> Header="CopyText"
SortMemberPath="Duration">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="vm:VariableItem"> <DataTemplate DataType="vm:VariableItem">
<Button <Button

View File

@@ -1,6 +1,5 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input.Platform;
using Semi.Avalonia.Demo.ViewModels; using Semi.Avalonia.Demo.ViewModels;
namespace Semi.Avalonia.Demo.Pages; namespace Semi.Avalonia.Demo.Pages;

View File

@@ -1,32 +0,0 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Semi.Avalonia.Demo.Pages.WindowCustomizationsPage"
x:CompileBindings="True">
<StackPanel
Spacing="10"
IsEnabled="{OnFormFactor False, Desktop=True}">
<TextBlock Classes="H2" Text="Desktop properties" />
<CheckBox Content="Extend Client Area to Decorations"
IsChecked="{Binding $parent[Window].ExtendClientAreaToDecorationsHint}" />
<Slider IsEnabled="{Binding $parent[Window].ExtendClientAreaToDecorationsHint}"
HorizontalAlignment="Left"
Width="201" Minimum="-1" Maximum="200"
Value="{Binding $parent[Window].ExtendClientAreaTitleBarHeightHint}" />
<CheckBox Content="Can Resize"
IsChecked="{Binding $parent[Window].CanResize}" />
<CheckBox Content="Can Minimize"
IsChecked="{Binding $parent[Window].CanMinimize}" />
<CheckBox Content="Can Maximize"
IsChecked="{Binding $parent[Window].CanMaximize}"
IsEnabled="{Binding $parent[Window].CanResize}" />
</StackPanel>
</UserControl>

View File

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

View File

@@ -14,18 +14,19 @@
<PackageReference Include="Avalonia"/> <PackageReference Include="Avalonia"/>
<PackageReference Include="Avalonia.Controls.ColorPicker"/> <PackageReference Include="Avalonia.Controls.ColorPicker"/>
<PackageReference Include="Avalonia.Controls.DataGrid"/> <PackageReference Include="Avalonia.Controls.DataGrid"/>
<!--Condition below is needed to remove AvaloniaUI.DiagnosticsSupport package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="AvaloniaUI.DiagnosticsSupport"> <PackageReference Include="Avalonia.Diagnostics">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm"/> <PackageReference Include="CommunityToolkit.Mvvm"/>
<PackageReference Include="Irihi.Avalonia.Shared"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/> <ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/> <ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/>
<ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/> <ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>
<!-- <ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>--> <ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using Avalonia; using Avalonia;

View File

@@ -16,9 +16,9 @@
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="TabItem"> <ControlTemplate TargetType="TabItem">
<TextBlock <TextBlock
Margin="4"
FontSize="12"
FontWeight="Bold" FontWeight="Bold"
FontSize="12"
Margin="4"
Text="{TemplateBinding Header}" /> Text="{TemplateBinding Header}" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
@@ -37,44 +37,48 @@
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSwitch <ToggleSwitch
Name="ExpandButton" Name="ExpandButton"
Content="{StaticResource SemiIconSidebar}" Theme="{DynamicResource IconBorderlessToggleSwitch}"
Theme="{DynamicResource IconBorderlessToggleSwitch}" /> Content="{StaticResource SemiIconSidebar}" />
<SelectableTextBlock <SelectableTextBlock
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="H6" Classes="H6"
Text="Semi Avalonia" Text="Semi Avalonia"
Theme="{DynamicResource TitleSelectableTextBlock}" /> Theme="{DynamicResource TitleSelectableTextBlock}" />
<SelectableTextBlock VerticalAlignment="Center" Text="/" /> <SelectableTextBlock
VerticalAlignment="Center"
Text="/" />
<SelectableTextBlock <SelectableTextBlock
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Secondary" Classes="Secondary"
Text="{ReflectionBinding #tab.SelectedItem.Header}" /> Text="{ReflectionBinding #tab.SelectedItem.Header}" />
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button <Button
Theme="{DynamicResource IconBorderlessButton}"
Command="{Binding OpenUrlCommand}" Command="{Binding OpenUrlCommand}"
CommandParameter="{Binding DocumentationUrl}" CommandParameter="{Binding DocumentationUrl}"
Content="{StaticResource SemiIconGlobe}" Content="{StaticResource SemiIconGlobe}" />
Theme="{DynamicResource IconBorderlessButton}" />
<Button <Button
Theme="{DynamicResource IconBorderlessButton}"
Command="{Binding OpenUrlCommand}" Command="{Binding OpenUrlCommand}"
CommandParameter="{Binding RepoUrl}" CommandParameter="{Binding RepoUrl}"
Content="{StaticResource SemiIconGithubLogo}" Content="{StaticResource SemiIconGithubLogo}" />
Theme="{DynamicResource IconBorderlessButton}" />
<ToggleSwitch <ToggleSwitch
Theme="{DynamicResource IconBorderlessToggleSwitch}"
Command="{Binding ToggleThemeCommand}" Command="{Binding ToggleThemeCommand}"
OffContent="{StaticResource SemiIconSun}"
OnContent="{StaticResource SemiIconMoon}" OnContent="{StaticResource SemiIconMoon}"
Theme="{DynamicResource IconBorderlessToggleSwitch}" /> OffContent="{StaticResource SemiIconSun}" />
<Button Content="{StaticResource SemiIconMenu}" Theme="{DynamicResource IconBorderlessButton}"> <Button
Theme="{DynamicResource IconBorderlessButton}"
Content="{StaticResource SemiIconMenu}">
<Button.Flyout> <Button.Flyout>
<MenuFlyout ItemsSource="{Binding MenuItems}" Placement="Bottom" /> <MenuFlyout Placement="Bottom" ItemsSource="{Binding MenuItems}" />
</Button.Flyout> </Button.Flyout>
<Button.Styles> <Button.Styles>
<Style x:DataType="views:MenuItemViewModel" Selector="MenuItem"> <Style Selector="MenuItem" x:DataType="views:MenuItemViewModel">
<Setter Property="Header" Value="{Binding Header}" /> <Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemsSource" Value="{Binding Items}" /> <Setter Property="ItemsSource" Value="{Binding Items}" />
<Setter Property="Command" Value="{Binding Command}" /> <Setter Property="Command" Value="{Binding Command}" />
@@ -90,8 +94,8 @@
Grid.Row="1" Grid.Row="1"
Margin="8" Margin="8"
Padding="20,0,0,0" Padding="20,0,0,0"
Classes.Dismiss="{Binding #ExpandButton.IsChecked}"
TabStripPlacement="Left" TabStripPlacement="Left"
Classes.Dismiss="{Binding #ExpandButton.IsChecked}"
Theme="{DynamicResource ScrollLineTabControl}"> Theme="{DynamicResource ScrollLineTabControl}">
<TabControl.Styles> <TabControl.Styles>
<Style Selector=".Dismiss /template/ ScrollViewer#PART_ScrollViewer"> <Style Selector=".Dismiss /template/ ScrollViewer#PART_ScrollViewer">
@@ -109,7 +113,9 @@
<TabItem Header="About Us"> <TabItem Header="About Us">
<pages:AboutUs /> <pages:AboutUs />
</TabItem> </TabItem>
<TabItem Header="Resource Browser" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Resource Browser" />
<TabItem Header="Palette"> <TabItem Header="Palette">
<pages:PaletteDemo /> <pages:PaletteDemo />
</TabItem> </TabItem>
@@ -122,17 +128,21 @@
<TabItem Header="Icon"> <TabItem Header="Icon">
<pages:IconDemo /> <pages:IconDemo />
</TabItem> </TabItem>
<TabItem Header="Separate Pack" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Separate Pack" />
<TabItem Header="ColorPicker"> <TabItem Header="ColorPicker">
<pages:ColorPickerDemo /> <pages:ColorPickerDemo />
</TabItem> </TabItem>
<TabItem Header="DataGrid"> <TabItem Header="DataGrid">
<pages:DataGridDemo /> <pages:DataGridDemo />
</TabItem> </TabItem>
<!-- <TabItem Header="TreeDataGrid"> --> <TabItem Header="TreeDataGrid">
<!-- <pages:TreeDataGridDemo /> --> <pages:TreeDataGridDemo />
<!-- </TabItem> --> </TabItem>
<TabItem Header="Basic" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Basic" />
<TabItem Header="TextBlock"> <TabItem Header="TextBlock">
<pages:TextBlockDemo /> <pages:TextBlockDemo />
</TabItem> </TabItem>
@@ -145,7 +155,9 @@
<TabItem Header="PathIcon"> <TabItem Header="PathIcon">
<pages:PathIconDemo /> <pages:PathIconDemo />
</TabItem> </TabItem>
<TabItem Header="Button" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Button" />
<TabItem Header="Button"> <TabItem Header="Button">
<pages:ButtonDemo /> <pages:ButtonDemo />
</TabItem> </TabItem>
@@ -161,7 +173,9 @@
<TabItem Header="ToggleSwitch"> <TabItem Header="ToggleSwitch">
<pages:ToggleSwitchDemo /> <pages:ToggleSwitchDemo />
</TabItem> </TabItem>
<TabItem Header="Input" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Input" />
<TabItem Header="TextBox"> <TabItem Header="TextBox">
<pages:TextBoxDemo /> <pages:TextBoxDemo />
</TabItem> </TabItem>
@@ -183,7 +197,9 @@
<TabItem Header="ManagedFileChooser"> <TabItem Header="ManagedFileChooser">
<pages:ManagedFileChooserDemo /> <pages:ManagedFileChooserDemo />
</TabItem> </TabItem>
<TabItem Header="Date/Time" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Date/Time" />
<TabItem Header="Calendar"> <TabItem Header="Calendar">
<pages:CalendarDemo /> <pages:CalendarDemo />
</TabItem> </TabItem>
@@ -196,22 +212,9 @@
<TabItem Header="TimePicker"> <TabItem Header="TimePicker">
<pages:TimePickerDemo /> <pages:TimePickerDemo />
</TabItem> </TabItem>
<TabItem Header="Navigation" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
<TabItem Header="ContentPage"> Theme="{DynamicResource CategoryTabItem}"
<pages:ContentPageDemo /> Header="Navigation" />
</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"> <TabItem Header="TabControl">
<pages:TabControlDemo /> <pages:TabControlDemo />
</TabItem> </TabItem>
@@ -221,13 +224,12 @@
<TabItem Header="TreeView"> <TabItem Header="TreeView">
<pages:TreeViewDemo /> <pages:TreeViewDemo />
</TabItem> </TabItem>
<TabItem Header="Show" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Show" />
<TabItem Header="Carousel"> <TabItem Header="Carousel">
<pages:CarouselDemo /> <pages:CarouselDemo />
</TabItem> </TabItem>
<TabItem Header="PipsPager">
<pages:PipsPagerDemo />
</TabItem>
<TabItem Header="Expander"> <TabItem Header="Expander">
<pages:ExpanderDemo /> <pages:ExpanderDemo />
</TabItem> </TabItem>
@@ -249,7 +251,9 @@
<TabItem Header="ToolTip"> <TabItem Header="ToolTip">
<pages:ToolTipDemo /> <pages:ToolTipDemo />
</TabItem> </TabItem>
<TabItem Header="Feedback" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
Theme="{DynamicResource CategoryTabItem}"
Header="Feedback" />
<TabItem Header="DataValidationErrors"> <TabItem Header="DataValidationErrors">
<pages:DataValidationErrorsDemo /> <pages:DataValidationErrorsDemo />
</TabItem> </TabItem>
@@ -262,10 +266,9 @@
<TabItem Header="RefreshContainer"> <TabItem Header="RefreshContainer">
<pages:RefreshContainerDemo /> <pages:RefreshContainerDemo />
</TabItem> </TabItem>
<TabItem Header="Other" Theme="{DynamicResource CategoryTabItem}" /> <TabItem
<TabItem Header="CommandBar"> Theme="{DynamicResource CategoryTabItem}"
<pages:CommandBarDemo /> Header="Other" />
</TabItem>
<TabItem Header="GridSplitter"> <TabItem Header="GridSplitter">
<pages:GridSplitterDemo /> <pages:GridSplitterDemo />
</TabItem> </TabItem>
@@ -278,9 +281,6 @@
<TabItem Header="ThemeVariantScope"> <TabItem Header="ThemeVariantScope">
<pages:ThemeVariantDemo /> <pages:ThemeVariantDemo />
</TabItem> </TabItem>
<TabItem Header="WindowCustomizationsPage">
<pages:WindowCustomizationsPage />
</TabItem>
</TabControl> </TabControl>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -5,11 +5,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:Semi.Avalonia.Demo.Views" xmlns:views="clr-namespace:Semi.Avalonia.Demo.Views"
Title="Semi Avalonia Demo" Title="Semi.Avalonia.Demo"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
ExtendClientAreaToDecorationsHint="True"
Icon="/Assets/irihi.ico" Icon="/Assets/irihi.ico"
mc:Ignorable="d"> mc:Ignorable="d">
<views:MainView Margin="{Binding $parent[Window].WindowDecorationMargin}" /> <views:MainView />
</Window> </Window>

View File

@@ -1,38 +1,11 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input;
namespace Semi.Avalonia.Demo.Views; namespace Semi.Avalonia.Demo.Views;
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private WindowState _stateBeforeFullScreen = WindowState.Normal;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
KeyDown += FullScreenKeyDown;
}
private void FullScreenKeyDown(object? sender, KeyEventArgs e)
{
if (e.Key == Key.F11)
{
ToggleFullScreen();
e.Handled = true;
}
}
private void ToggleFullScreen()
{
if (WindowState is not WindowState.FullScreen)
{
_stateBeforeFullScreen = WindowState;
WindowState = WindowState.FullScreen;
}
else
{
WindowState = _stateBeforeFullScreen;
}
} }
} }

View File

@@ -16,7 +16,6 @@
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl> <PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon> <PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>

View File

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

View File

@@ -6,7 +6,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" /> <ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" /> <ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -1,49 +1,39 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared" xmlns:converters="using:Avalonia.Controls.Converters">
xmlns:semi="https://irihi.tech/semi"> <converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<Design.PreviewWith> <converters:ToBrushConverter x:Key="ToBrushConverter" />
<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"> <ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI --> <Setter Property="MinWidth" Value="64" />
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Padding" Value="0 0 10 0" />
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<Panel> <Panel>
<Border <Border
Margin="1,1,0,1" Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}" Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" /> CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
<Border <Border
Margin="1,1,0,1" Margin="1,1,0,1"
Width="{Binding $self.Bounds.Height}"
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}" Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" /> CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
</Panel> </Panel>
</Template> </Template>
</Setter> </Setter>
<Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorPicker"> <ControlTemplate TargetType="{x:Type ColorPicker}">
<DropDownButton <DropDownButton
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}" MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}" MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -59,9 +49,7 @@
</Style> </Style>
</DropDownButton.Styles> </DropDownButton.Styles>
<DropDownButton.Flyout> <DropDownButton.Flyout>
<Flyout <Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource ColorPickerFlyoutPlacement}">
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource ColorPickerFlyoutPlacement}">
<!-- <!--
The following is copy-pasted from the ColorView's control template. The following is copy-pasted from the ColorView's control template.
@@ -69,6 +57,7 @@
Note the only changes are resources specific to the ColorPicker. Note the only changes are resources specific to the ColorPicker.
--> -->
<Grid <Grid
Name="RootGrid"
Width="300" Width="300"
Height="300" Height="300"
RowDefinitions="*,Auto"> RowDefinitions="*,Auto">
@@ -92,7 +81,7 @@
Padding="0" Padding="0"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}"> SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<TabControl.Styles> <TabControl.Styles>
<Style Selector="TabItem"> <Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" /> <Setter Property="MinHeight" Value="32" />
@@ -127,11 +116,11 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component" AutomationProperties.Name="Third Component"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}" ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorModel="Hsva" ColorModel="Hsva"
HsvColor="{Binding #ColorSpectrum.HsvColor}" HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="False" IsAlphaVisible="True"
IsPerceptive="True" IsPerceptive="False"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}" IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" /> Orientation="Vertical" />
<ColorSpectrum <ColorSpectrum
@@ -140,7 +129,7 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}" Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}" MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}" MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}" MaxValue="{TemplateBinding MaxValue}"
@@ -157,10 +146,14 @@
AutomationProperties.Name="Alpha Component" AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha" ColorComponent="Alpha"
ColorModel="Hsva" ColorModel="Hsva"
HsvColor="{Binding #ColorSpectrum.HsvColor}" HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical"> Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider> </ColorSlider>
</Grid> </Grid>
</TabItem> </TabItem>
@@ -175,13 +168,13 @@
<ListBox <ListBox
Margin="12" Margin="12"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}" ItemContainerTheme="{DynamicResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}" ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}" SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}" Theme="{DynamicResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False"> UseLayoutRounding="False">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="Color"> <DataTemplate DataType="{x:Type Color}">
<Border <Border
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
@@ -212,11 +205,7 @@
Margin="12" Margin="12"
ColumnDefinitions="Auto,*" ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12" RowDefinitions="Auto,24,*,*,*,*,12"
UseLayoutRounding="False"> Tag="{TemplateBinding ColorModel}">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles> <Grid.Styles>
<Style Selector="NumericUpDown"> <Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent"> <Setter Property="InnerLeftContent">
@@ -225,6 +214,34 @@
</Template> </Template>
</Setter> </Setter>
</Style> </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> </Grid.Styles>
<!-- Top color model & Hex input --> <!-- Top color model & Hex input -->
<Grid <Grid
@@ -285,11 +302,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component1Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding #Component1Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component1Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component1Slider}" />
<ColorSlider <ColorSlider
Name="Component1Slider" Name="Component1Slider"
Grid.Row="2" Grid.Row="2"
@@ -298,7 +315,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component1" ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -315,11 +332,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component2Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding #Component2Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component2Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component2Slider}" />
<ColorSlider <ColorSlider
Name="Component2Slider" Name="Component2Slider"
Grid.Row="3" Grid.Row="3"
@@ -328,7 +345,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component2" ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -345,11 +362,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component3Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding #Component3Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component3Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component3Slider}" />
<ColorSlider <ColorSlider
Name="Component3Slider" Name="Component3Slider"
Grid.Row="4" Grid.Row="4"
@@ -358,7 +375,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component3" ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -375,15 +392,15 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #AlphaComponentSlider.Maximum}" Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding #AlphaComponentSlider.Minimum}" Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> Value="{Binding Value, ElementName=AlphaComponentSlider}">
<NumericUpDown.IsVisible> <NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="IsAlphaVisible" /> <Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsComponentTextInputVisible" /> <Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</NumericUpDown.IsVisible> </NumericUpDown.IsVisible>
</NumericUpDown> </NumericUpDown>
@@ -395,7 +412,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Alpha" ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
@@ -403,8 +420,8 @@
TickFrequency="1"> TickFrequency="1">
<ColorSlider.IsVisible> <ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="IsAlphaVisible" /> <Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsComponentSliderVisible" /> <Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</ColorSlider.IsVisible> </ColorSlider.IsVisible>
</ColorSlider> </ColorSlider>
@@ -412,11 +429,11 @@
</TabItem> </TabItem>
</TabControl> </TabControl>
<!-- Previewer --> <!-- Previewer -->
<!-- Note that the drop shadow is allowed to extend past the control bounds --> <!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<ColorPreviewer <ColorPreviewer
Grid.Row="1" Grid.Row="1"
Margin="12,0,12,12" Margin="12,-5,12,7"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}" IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" /> IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid> </Grid>
@@ -425,33 +442,9 @@
</DropDownButton> </DropDownButton>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^[ColorModel=Rgba]">
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown"> <Style Selector="^ /template/ DropDownButton">
<Setter Property="Tag" Value="R" /> <Setter Property="Padding" Value="0 0 10 0" />
</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> </Style>
</ControlTheme> </ControlTheme>
@@ -459,34 +452,38 @@
x:Key="HexColorPicker" x:Key="HexColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}" BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker"> TargetType="ColorPicker">
<Setter Property="MinWidth" Value="180" /> <Setter Property="MinWidth" Value="200" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" /> <Setter Property="Content">
</ControlTheme> <Template>
<Template x:Key="HexColorPickerTemplate">
<Grid ColumnDefinitions="Auto, *"> <Grid ColumnDefinitions="Auto, *">
<Border <Border
Grid.Column="0" Grid.Column="0"
Width="{Binding $self.Bounds.Height}" Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1" Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}" Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" /> CornerRadius="{TemplateBinding CornerRadius}" />
<Border <Border
Grid.Column="0" Grid.Column="0"
Width="{Binding $self.Bounds.Height}" Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1" Margin="1,1,0,1"
Background="{Binding $parent[ColorPicker].HsvColor,Converter={StaticResource ToBrushConverter}}" HorizontalAlignment="Stretch"
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" /> VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
Margin="8,0,0,0" Margin="8,0,0,0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource TextBlockDefaultForeground}"> FontWeight="Regular"
<Run Text="#" /> Foreground="{DynamicResource TextBlockDefaultForeground}"
<Run Text="{Binding $parent[ColorPicker].Color, Converter={StaticResource ColorToHexConverter}}" /> Text="{Binding $parent[ColorPicker].Color}" />
</TextBlock>
</Grid> </Grid>
</Template> </Template>
</Setter>
</ControlTheme>
<ControlTheme <ControlTheme
x:Key="SimpleColorPicker" x:Key="SimpleColorPicker"
@@ -494,13 +491,12 @@
TargetType="ColorPicker"> TargetType="ColorPicker">
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" /> <Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorPicker"> <ControlTemplate TargetType="{x:Type ColorPicker}">
<DropDownButton <DropDownButton
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}" MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}" MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
@@ -515,16 +511,14 @@
</Style> </Style>
</DropDownButton.Styles> </DropDownButton.Styles>
<DropDownButton.Flyout> <DropDownButton.Flyout>
<Flyout <Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
FlyoutPresenterClasses="nopadding"
Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<!-- <!--
The following is copy-pasted from the ColorView's control template. The following is copy-pasted from the ColorView's control template.
It MUST always be kept in sync with the ColorView (which is master). It MUST always be kept in sync with the ColorView (which is master).
Note the only changes are resources specific to the ColorPicker. Note the only changes are resources specific to the ColorPicker.
--> -->
<Grid> <Grid Width="280">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" /> <RowDefinition Height="*" MinHeight="280" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -540,7 +534,6 @@
Name="ColorSpectrum" Name="ColorSpectrum"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}" Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}" MaxHue="{TemplateBinding MaxHue}"
@@ -591,43 +584,35 @@
CornerRadius="4" /> CornerRadius="4" />
<Panel <Panel
Name="PART_TextBoxPanel" Name="PART_TextBoxPanel"
Width="116" Width="106"
Margin="4 0 0 0" Margin="4 0 0 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center"> VerticalAlignment="Center">
<TextBox <TextBox
Name="PART_HexTextBox" Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#" InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
MaxLength="8"> Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
<TextBox.Resources> MaxLength="8" />
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox <TextBox
Name="PART_RgbaTextBox" Name="PART_RgbaTextBox"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}" Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox <TextBox
Name="PART_HsvaTextBox" Name="PART_HsvaTextBox"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}" Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel> </Panel>
<NumericUpDown <NumericUpDown
Name="AlphaComponentNumericUpDown" Name="AlphaComponentNumericUpDown"
Width="60" Width="70"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" VerticalAlignment="Center"
AllowSpin="True" AllowSpin="True"
CornerRadius="0"
Classes="Small" Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}" Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -636,21 +621,14 @@
ShowButtonSpinner="False" ShowButtonSpinner="False"
InnerRightContent="%" InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}" IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox <ComboBox
Name="ColorModelComboBox" Name="ColorModelComboBox"
Width="80" Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Small" Classes="Small"
SelectedValue="Hex"> SelectedValue="Hex">
<x:String>Hex</x:String> Hex<ColorModel>Rgba</ColorModel>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel> <ColorModel>Hsva</ColorModel>
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
@@ -669,8 +647,37 @@
x:Key="HexSimpleColorPicker" x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}" BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker"> TargetType="ColorPicker">
<Setter Property="MinWidth" Value="180" /> <Setter Property="MinWidth" Value="200" />
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" /> <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>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,13 +1,17 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"> xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters">
<pc:AccentColorConverter x:Key="AccentColorConverter" />
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
<converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight" />
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer"> <ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" /> <Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorPreviewer"> <ControlTemplate TargetType="{x:Type ColorPreviewer}">
<Panel> <Panel>
<!-- Preview color with accents to the left and right --> <!-- Preview color with accents to the left and right -->
<Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}"> <Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}">
@@ -30,7 +34,7 @@
Background="{TemplateBinding HsvColor, Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter}, Converter={StaticResource AccentColorConverter},
ConverterParameter='-2'}" ConverterParameter='-2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Left}}" CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource LeftCornerRadiusFilterConverter}}"
Tag="-2" /> Tag="-2" />
<Border <Border
Name="PART_AccentDecrement1Border" Name="PART_AccentDecrement1Border"
@@ -66,7 +70,7 @@
Background="{TemplateBinding HsvColor, Background="{TemplateBinding HsvColor,
Converter={StaticResource AccentColorConverter}, Converter={StaticResource AccentColorConverter},
ConverterParameter='2'}" ConverterParameter='2'}"
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Right}}" CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource RightCornerRadiusFilterConverter}}"
Tag="2" /> Tag="2" />
</Grid> </Grid>
<!-- Preview color: Must be last for drop shadow Z-index --> <!-- Preview color: Must be last for drop shadow Z-index -->

View File

@@ -1,6 +1,9 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
<ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb"> <ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
@@ -9,7 +12,7 @@
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" /> <Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="Thumb"> <ControlTemplate>
<Border <Border
Margin="1" Margin="1"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
@@ -27,30 +30,33 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" /> <Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorSlider"> <ControlTemplate TargetType="{x:Type ColorSlider}">
<Border <Border
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}"> <Grid Margin="{TemplateBinding Padding}">
<Border <Rectangle
HorizontalAlignment="Stretch" Width="{Binding #PART_Track.Bounds.Width}"
VerticalAlignment="Center"
Height="{Binding #PART_Track.Bounds.Height}" Height="{Binding #PART_Track.Bounds.Height}"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
<Border
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="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}" Height="{Binding #PART_Track.Bounds.Height}"
Background="{TemplateBinding Background}" HorizontalAlignment="Stretch"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" /> VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Track <Track
Name="PART_Track" Name="PART_Track"
Height="12" Height="12"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Stretch"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}" Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}" Minimum="{TemplateBinding Minimum}"
@@ -95,7 +101,7 @@
Width="{TemplateBinding Height}" Width="{TemplateBinding Height}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
DataContext="{TemplateBinding Value}" DataContext="{TemplateBinding Value}"
Theme="{DynamicResource ColorSliderThumbTheme}" /> Theme="{StaticResource ColorSliderThumbTheme}" />
</Track> </Track>
</Grid> </Grid>
</Border> </Border>
@@ -108,28 +114,32 @@
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
<Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" /> <Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorSlider"> <ControlTemplate TargetType="{x:Type ColorSlider}">
<Border <Border
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}"> <Grid Margin="{TemplateBinding Padding}">
<Border <Rectangle
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Width="{Binding #PART_Track.Bounds.Width}" Width="{Binding #PART_Track.Bounds.Width}"
Background="{StaticResource ColorControlCheckeredBackgroundBrush}" Height="{Binding #PART_Track.Bounds.Height}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" /> HorizontalAlignment="Stretch"
<Border
HorizontalAlignment="Center"
VerticalAlignment="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}" Width="{Binding #PART_Track.Bounds.Width}"
Background="{TemplateBinding Background}" Height="{Binding #PART_Track.Bounds.Height}"
CornerRadius="{DynamicResource ColorSliderCornerRadius}" /> HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="{TemplateBinding Background}"
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Track <Track
Name="PART_Track" Name="PART_Track"
Width="12" Width="12"
HorizontalAlignment="Center" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}" Maximum="{TemplateBinding Maximum}"
@@ -175,7 +185,7 @@
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Width}" Height="{TemplateBinding Width}"
DataContext="{TemplateBinding Value}" DataContext="{TemplateBinding Value}"
Theme="{DynamicResource ColorSliderThumbTheme}" /> Theme="{StaticResource ColorSliderThumbTheme}" />
</Track> </Track>
</Grid> </Grid>
</Border> </Border>

View File

@@ -1,11 +1,15 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum"> <ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorSpectrum"> <ControlTemplate TargetType="{x:Type ColorSpectrum}">
<Panel <Panel
Name="PART_LayoutRoot" Name="PART_LayoutRoot"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@@ -21,27 +25,27 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}" ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Rectangle <Rectangle
Name="PART_SpectrumOverlayRectangle" Name="PART_SpectrumOverlayRectangle"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}" ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse <Ellipse
Name="PART_SpectrumEllipse" Name="PART_SpectrumEllipse"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" /> ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Ellipse <Ellipse
Name="PART_SpectrumOverlayEllipse" Name="PART_SpectrumOverlayEllipse"
@@ -49,7 +53,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" /> ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
<Canvas <Canvas
Name="PART_InputTarget" Name="PART_InputTarget"
@@ -85,17 +89,17 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Box}}" ConverterParameter={x:Static ColorSpectrumShape.Box}}"
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
<Ellipse <Ellipse
Name="BorderEllipse" Name="BorderEllipse"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
IsVisible="{TemplateBinding Shape, IsVisible="{TemplateBinding Shape,
Converter={x:Static ObjectConverters.Equal}, Converter={StaticResource EnumToBoolConverter},
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" /> ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
</Panel> </Panel>
</Panel> </Panel>

View File

@@ -1,23 +1,28 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"> 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" />
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel>
<ColorView <ColorView
SelectedIndex="2" Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True" IsAlphaVisible="True"
IsAlphaEnabled="True" IsAlphaEnabled="True"
ColorModel="Hsva" ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" /> HsvColor="hsv(120,7%,90%)" />
<ColorView
Theme="{DynamicResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
<VisualBrush <VisualBrush
@@ -27,12 +32,16 @@
TileMode="Tile"> TileMode="Tile">
<VisualBrush.Visual> <VisualBrush.Visual>
<Image Width="8" Height="8"> <Image Width="8" Height="8">
<Image.Source>
<DrawingImage> <DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup> <DrawingGroup>
<GeometryDrawing Brush="Transparent" Geometry="M0 0H2V2H0Z" /> <GeometryDrawing Brush="Transparent" Geometry="M0,0 L2,0 2,2, 0,2Z" />
<GeometryDrawing Brush="#19808080" Geometry="M0 1H2V2H1V0H0Z" /> <GeometryDrawing Brush="#19808080" Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z" />
</DrawingGroup> </DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage> </DrawingImage>
</Image.Source>
</Image> </Image>
</VisualBrush.Visual> </VisualBrush.Visual>
</VisualBrush> </VisualBrush>
@@ -52,11 +61,11 @@
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer <ScrollViewer
Name="PART_ScrollViewer" Name="PART_ScrollViewer"
AllowAutoHide="{TemplateBinding ScrollViewer.AllowAutoHide}" AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding ScrollViewer.IsScrollChainingEnabled}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<ItemsPresenter <ItemsPresenter
Name="PART_ItemsPresenter" Name="PART_ItemsPresenter"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
@@ -73,8 +82,8 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem"> <ControlTemplate TargetType="{x:Type ListBoxItem}">
<Panel UseLayoutRounding="False"> <Grid UseLayoutRounding="False">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
@@ -92,7 +101,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="False" IsHitTestVisible="False"
StrokeThickness="1" /> StrokeThickness="1" />
</Panel> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
@@ -132,14 +141,12 @@
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
RecognizesAccessKey="True"
TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="{TemplateBinding FontWeight}" TextElement.FontWeight="{TemplateBinding FontWeight}"
UseLayoutRounding="False" /> UseLayoutRounding="False" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
<Style Selector="^:checked"> <Style Selector="^:checked">
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" /> <Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" />
@@ -161,14 +168,14 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView"> <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="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Width" Value="300" /> <Setter Property="Width" Value="300" />
<Setter Property="Height" Value="300" /> <Setter Property="Height" Value="300" />
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" /> <Setter Property="Palette">
<FluentColorPalette />
</Setter>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorView"> <ControlTemplate TargetType="{x:Type ColorView}">
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<!-- Backgrounds --> <!-- Backgrounds -->
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" --> <!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
@@ -190,7 +197,7 @@
Padding="0" Padding="0"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}"> SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<TabControl.Styles> <TabControl.Styles>
<Style Selector="TabItem"> <Style Selector="TabItem">
<Setter Property="MinHeight" Value="32" /> <Setter Property="MinHeight" Value="32" />
@@ -225,11 +232,11 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
AutomationProperties.Name="Third Component" AutomationProperties.Name="Third Component"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}" ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
ColorModel="Hsva" ColorModel="Hsva"
HsvColor="{Binding #ColorSpectrum.HsvColor}" HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsAlphaVisible="False" IsAlphaVisible="True"
IsPerceptive="True" IsPerceptive="False"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}" IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Vertical" /> Orientation="Vertical" />
<ColorSpectrum <ColorSpectrum
@@ -238,7 +245,7 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}" Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}" MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}" MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}" MaxValue="{TemplateBinding MaxValue}"
@@ -255,10 +262,14 @@
AutomationProperties.Name="Alpha Component" AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha" ColorComponent="Alpha"
ColorModel="Hsva" ColorModel="Hsva"
HsvColor="{Binding #ColorSpectrum.HsvColor}" HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Orientation="Vertical"> Orientation="Vertical">
<ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</ColorSlider.IsVisible>
</ColorSlider> </ColorSlider>
</Grid> </Grid>
</TabItem> </TabItem>
@@ -275,11 +286,11 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}" ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
ItemsSource="{TemplateBinding PaletteColors}" ItemsSource="{TemplateBinding PaletteColors}"
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}" SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
Theme="{StaticResource ColorViewPaletteListBoxTheme}" Theme="{StaticResource ColorViewPaletteListBoxTheme}"
UseLayoutRounding="False"> UseLayoutRounding="False">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="Color"> <DataTemplate DataType="{x:Type Color}">
<Border <Border
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
@@ -311,10 +322,6 @@
ColumnDefinitions="Auto,*" ColumnDefinitions="Auto,*"
RowDefinitions="Auto,24,*,*,*,*,12" RowDefinitions="Auto,24,*,*,*,*,12"
UseLayoutRounding="False"> UseLayoutRounding="False">
<Grid.Resources>
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
</Grid.Resources>
<Grid.Styles> <Grid.Styles>
<Style Selector="NumericUpDown"> <Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent"> <Setter Property="InnerLeftContent">
@@ -383,11 +390,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component1Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component1Slider}"
Minimum="{Binding #Component1Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component1Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component1Slider}" />
<ColorSlider <ColorSlider
Name="Component1Slider" Name="Component1Slider"
Grid.Row="2" Grid.Row="2"
@@ -396,7 +403,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component1" ColorComponent="Component1"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -413,11 +420,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component2Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component2Slider}"
Minimum="{Binding #Component2Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component2Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component2Slider}" />
<ColorSlider <ColorSlider
Name="Component2Slider" Name="Component2Slider"
Grid.Row="3" Grid.Row="3"
@@ -426,7 +433,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component2" ColorComponent="Component2"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -443,11 +450,11 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsVisible="{TemplateBinding IsComponentTextInputVisible}" IsVisible="{TemplateBinding IsComponentTextInputVisible}"
Maximum="{Binding #Component3Slider.Maximum}" Maximum="{Binding Maximum, ElementName=Component3Slider}"
Minimum="{Binding #Component3Slider.Minimum}" Minimum="{Binding Minimum, ElementName=Component3Slider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> Value="{Binding Value, ElementName=Component3Slider}" />
<ColorSlider <ColorSlider
Name="Component3Slider" Name="Component3Slider"
Grid.Row="4" Grid.Row="4"
@@ -456,7 +463,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Component3" ColorComponent="Component3"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsVisible="{TemplateBinding IsComponentSliderVisible}" IsVisible="{TemplateBinding IsComponentSliderVisible}"
@@ -473,15 +480,15 @@
AllowSpin="True" AllowSpin="True"
Classes="Small" Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #AlphaComponentSlider.Maximum}" Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Minimum="{Binding #AlphaComponentSlider.Minimum}" Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False" ShowButtonSpinner="False"
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> Value="{Binding Value, ElementName=AlphaComponentSlider}">
<NumericUpDown.IsVisible> <NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="IsAlphaVisible" /> <Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsComponentTextInputVisible" /> <Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</NumericUpDown.IsVisible> </NumericUpDown.IsVisible>
</NumericUpDown> </NumericUpDown>
@@ -493,7 +500,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
ColorComponent="Alpha" ColorComponent="Alpha"
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsRoundingEnabled="True" IsRoundingEnabled="True"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
@@ -501,8 +508,8 @@
TickFrequency="1"> TickFrequency="1">
<ColorSlider.IsVisible> <ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="IsAlphaVisible" /> <Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="IsComponentSliderVisible" /> <Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding> </MultiBinding>
</ColorSlider.IsVisible> </ColorSlider.IsVisible>
</ColorSlider> </ColorSlider>
@@ -510,11 +517,11 @@
</TabItem> </TabItem>
</TabControl> </TabControl>
<!-- Previewer --> <!-- Previewer -->
<!-- Note that the drop shadow is allowed to extend past the control bounds --> <!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
<ColorPreviewer <ColorPreviewer
Grid.Row="1" Grid.Row="1"
Margin="12,0,12,12" Margin="12,-5,12,7"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}" IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
IsVisible="{TemplateBinding IsColorPreviewVisible}" /> IsVisible="{TemplateBinding IsColorPreviewVisible}" />
</Grid> </Grid>
@@ -551,12 +558,11 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView"> <ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
<Setter Property="Width" Value="280" /> <Setter Property="Width" Value="280" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" /> <Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ColorView"> <ControlTemplate TargetType="{x:Type ColorView}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" /> <RowDefinition Height="*" MinHeight="280" />
@@ -573,7 +579,6 @@
Name="ColorSpectrum" Name="ColorSpectrum"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
CornerRadius="8 8 0 0"
Components="{TemplateBinding ColorSpectrumComponents}" Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}" MaxHue="{TemplateBinding MaxHue}"
@@ -597,7 +602,7 @@
Orientation="Horizontal" /> Orientation="Horizontal" />
<ColorSlider <ColorSlider
Name="ColorSpectrumAlphaSlider" x:Name="ColorSpectrumAlphaSlider"
Grid.Row="2" Grid.Row="2"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -624,43 +629,35 @@
CornerRadius="4" /> CornerRadius="4" />
<Panel <Panel
Name="PART_TextBoxPanel" Name="PART_TextBoxPanel"
Width="116" Width="106"
Margin="4 0 0 0" Margin="4 0 0 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center"> VerticalAlignment="Center">
<TextBox <TextBox
Name="PART_HexTextBox" Name="PART_HexTextBox"
AutomationProperties.Name="Hexadecimal Color"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3"
InnerLeftContent="#" InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
MaxLength="8"> Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
<TextBox.Resources> MaxLength="8" />
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
</TextBox.Resources>
</TextBox>
<TextBox <TextBox
Name="PART_RgbaTextBox" Name="PART_RgbaTextBox"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}" Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
<TextBox <TextBox
Name="PART_HsvaTextBox" Name="PART_HsvaTextBox"
Classes="Small" Classes="Small"
CornerRadius="3 0 0 3" IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}" Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel> </Panel>
<NumericUpDown <NumericUpDown
Name="AlphaComponentNumericUpDown" Name="AlphaComponentNumericUpDown"
Width="60" Width="70"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" VerticalAlignment="Center"
AllowSpin="True" AllowSpin="True"
CornerRadius="0"
Classes="Small" Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}" IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}" Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
@@ -669,21 +666,14 @@
ShowButtonSpinner="False" ShowButtonSpinner="False"
InnerRightContent="%" InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}" IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
<NumericUpDown.Resources>
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
</NumericUpDown.Resources>
</NumericUpDown>
<ComboBox <ComboBox
Name="ColorModelComboBox" Name="ColorModelComboBox"
Width="80" Width="80"
CornerRadius="0 3 3 0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Small" Classes="Small"
SelectedValue="Hex"> SelectedValue="Hex">
<x:String>Hex</x:String> Hex<ColorModel>Rgba</ColorModel>
<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel> <ColorModel>Hsva</ColorModel>
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>

View File

@@ -1,17 +0,0 @@
<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>

View File

@@ -2,7 +2,6 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Converters.axaml" />
<ResourceInclude Source="ColorPicker.axaml" /> <ResourceInclude Source="ColorPicker.axaml" />
<ResourceInclude Source="ColorPreviewer.axaml" /> <ResourceInclude Source="ColorPreviewer.axaml" />
<ResourceInclude Source="ColorSlider.axaml" /> <ResourceInclude Source="ColorSlider.axaml" />

View File

@@ -3,19 +3,19 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Avalonia; using Avalonia;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters; namespace Semi.Avalonia.ColorPicker.Converters;
public class ColorToTextConverter : MarkupValueConverter public class ColorToTextConverter : IValueConverter
{ {
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) public 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; return value is Color color ? $"{color.R},{color.G},{color.B},{color.A}" : AvaloniaProperty.UnsetValue;
} }
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (value is not string str) return BindingOperations.DoNothing; if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(','); var parts = str.Split(',');

View File

@@ -3,21 +3,21 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Avalonia; using Avalonia;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Semi.Avalonia.ColorPicker.Converters; namespace Semi.Avalonia.ColorPicker.Converters;
public class HsvColorToTextConverter : MarkupValueConverter public class HsvColorToTextConverter : IValueConverter
{ {
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
return value is HsvColor hsvColor return value is HsvColor hsvColor
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}" ? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
: AvaloniaProperty.UnsetValue; : AvaloniaProperty.UnsetValue;
} }
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (value is not string str) return BindingOperations.DoNothing; if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(','); var parts = str.Split(',');

View File

@@ -0,0 +1,21 @@
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();
}
}

View File

@@ -3,7 +3,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" /> <ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" /> <ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -1,5 +1,3 @@
using Avalonia.Metadata; 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")]
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker.Converters")]

View File

@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Version>12.0.0</Version> <Version>11.3.7.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0</PackageReleaseNotes> <PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.3.7.3</PackageReleaseNotes>
<Title>Semi.Avalonia.ColorPicker</Title> <Title>Semi.Avalonia.ColorPicker</Title>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Controls.ColorPicker"/> <PackageReference Include="Avalonia.Controls.ColorPicker"/>
<PackageReference Include="Irihi.Avalonia.Shared"/>
<None Include="README.md" Pack="true" PackagePath="\"/> <None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup> </ItemGroup>

View File

@@ -1,12 +1,12 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Irihi.Avalonia.Shared.Helpers; using Avalonia.Utilities;
namespace Semi.Avalonia.ColorPicker; namespace Semi.Avalonia.ColorPicker;
public class SemiColorDarkPalette: IColorPalette public class SemiColorDarkPalette: IColorPalette
{ {
private static readonly Color[,] Colors = new[,] private static readonly Color[,] Colors = new Color[,]
{ {
{ {
//Red //Red
@@ -216,26 +216,12 @@ public class SemiColorDarkPalette : IColorPalette
Color.FromUInt32(0xFFE6E8EA), Color.FromUInt32(0xFFE6E8EA),
Color.FromUInt32(0xFFF9F9F9), 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) public Color GetColor(int colorIndex, int shadeIndex)
{ {
return Colors[ return Colors[
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1), MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1) MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
]; ];
} }

View File

@@ -1,12 +1,12 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Irihi.Avalonia.Shared.Helpers; using Avalonia.Utilities;
namespace Semi.Avalonia.ColorPicker; namespace Semi.Avalonia.ColorPicker;
public class SemiColorLightPalette: IColorPalette public class SemiColorLightPalette: IColorPalette
{ {
private static readonly Color[,] Colors = new[,] private static readonly Color[,] Colors = new Color[,]
{ {
{ {
//Red //Red
@@ -216,26 +216,12 @@ public class SemiColorLightPalette : IColorPalette
Color.FromUInt32(0xFF2E3238), Color.FromUInt32(0xFF2E3238),
Color.FromUInt32(0xFF1C1F23), 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) public Color GetColor(int colorIndex, int shadeIndex)
{ {
return Colors[ return Colors[
MathHelpers.SafeClamp(colorIndex, 0, ColorCount - 1), MathUtilities.Clamp(colorIndex, 0, ColorCount - 1),
MathHelpers.SafeClamp(shadeIndex, 0, ShadeCount - 1) MathUtilities.Clamp(shadeIndex, 0, ShadeCount - 1)
]; ];
} }

View File

@@ -6,7 +6,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" /> <ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" /> <ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -3,7 +3,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceInclude x:Key="Default" Source="Light.axaml" /> <ResourceInclude x:Key="Default" Source="Light.axaml" />
<ResourceInclude x:Key="Light" Source="Light.axaml" />
<ResourceInclude x:Key="Dark" Source="Dark.axaml" /> <ResourceInclude x:Key="Dark" Source="Dark.axaml" />
</ResourceDictionary.ThemeDictionaries> </ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Version>12.0.0</Version> <Version>11.3.7.3</Version>
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0</PackageReleaseNotes> <PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 11.3.7.3</PackageReleaseNotes>
<Title>Semi.Avalonia.DataGrid</Title> <Title>Semi.Avalonia.DataGrid</Title>
</PropertyGroup> </PropertyGroup>

View File

@@ -2,9 +2,9 @@
x:Class="Semi.Avalonia.SemiPopupAnimations" x:Class="Semi.Avalonia.SemiPopupAnimations"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"> xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
<Style Selector="Popup LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup LayoutTransformControl#PART_LayoutTransform">
<Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={semi:PlacementToRenderTransformOriginConverter}}" /> <Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={x:Static converters:PlacementToRenderTransformOriginConverter.Instance}}" />
</Style> </Style>
<Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform"> <Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform">

View File

@@ -1,16 +1,14 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:iri="https://irihi.tech/shared">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Margin="20" Spacing="20"> <StackPanel Margin="20" Spacing="20">
<TextBox Text="Hello" /> <TextBox Text="Hello" />
<AutoCompleteBox Width="100" PlaceholderText="Hello" /> <AutoCompleteBox Width="100" />
</StackPanel> </StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
<ControlTheme x:Key="{x:Type AutoCompleteBox}" TargetType="AutoCompleteBox"> <ControlTheme x:Key="{x:Type AutoCompleteBox}" TargetType="AutoCompleteBox">
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxDefaultHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxDefaultHeight}" />
<Setter Property="MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" /> <Setter Property="MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" />
<Setter Property="Template"> <Setter Property="Template">
@@ -26,8 +24,7 @@
Theme="{DynamicResource NonErrorTextBox}" Theme="{DynamicResource NonErrorTextBox}"
InnerLeftContent="{TemplateBinding InnerLeftContent}" InnerLeftContent="{TemplateBinding InnerLeftContent}"
InnerRightContent="{TemplateBinding InnerRightContent}" InnerRightContent="{TemplateBinding InnerRightContent}"
PlaceholderForeground="{TemplateBinding PlaceholderForeground}" Watermark="{TemplateBinding Watermark}" />
PlaceholderText="{TemplateBinding PlaceholderText}" />
<Popup <Popup
Name="PART_Popup" Name="PART_Popup"
MaxHeight="{TemplateBinding MaxDropDownHeight}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
@@ -58,13 +55,45 @@
</Setter> </Setter>
<Style Selector="^.Bordered"> <Style Selector="^.Bordered">
<Style Selector="^ /template/ TextBox#PART_TextBox"> <Setter Property="Template">
<Setter Property="MinHeight" Value="0" /> <ControlTemplate TargetType="AutoCompleteBox">
<Setter Property="iri:ClassHelper.Classes" Value="Bordered" /> <Panel>
</Style> <TextBox
<Style Selector="^ /template/ ListBox#PART_SelectingItemsControl"> Name="PART_TextBox"
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="False" /> VerticalAlignment="Stretch"
</Style> MinHeight="0"
Classes="Bordered"
ClearSelectionOnLostFocus="{TemplateBinding ClearSelectionOnLostFocus}"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Watermark="{TemplateBinding Watermark}" />
<Popup
Name="PART_Popup"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
InheritsTransform="True"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}">
<Border
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
HorizontalAlignment="Stretch"
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.IsScrollChainingEnabled="False" />
</Border>
</Popup>
</Panel>
</ControlTemplate>
</Setter>
</Style> </Style>
<Style Selector="^.Large"> <Style Selector="^.Large">
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxLargeHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxLargeHeight}" />

View File

@@ -20,7 +20,6 @@
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}" /> ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
@@ -93,7 +92,7 @@
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:left /template/ Border#ButtonGroup"> <Style Selector="^[ButtonSpinnerLocation=Left] /template/ Border#ButtonGroup">
<Setter Property="Grid.Column" Value="0" /> <Setter Property="Grid.Column" Value="0" />
<Setter Property="Margin" Value="0 0 4 0" /> <Setter Property="Margin" Value="0 0 4 0" />
</Style> </Style>
@@ -101,70 +100,4 @@
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonPointeroverBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonPointeroverBorderBrush}" />
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="SplitButtonSpinner" TargetType="ButtonSpinner">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="MinWidth" Value="200" />
<Setter Property="Template">
<ControlTemplate TargetType="ButtonSpinner">
<Grid ColumnDefinitions="Auto, *, Auto">
<RepeatButton
Name="PART_DecreaseButton"
Grid.Column="0"
VerticalAlignment="Stretch"
Padding="{DynamicResource SplitButtonSpinnerButtonPadding}"
BorderBrush="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}"
BorderThickness="{DynamicResource ButtonSpinnerButtonGroupBorderThickness}"
CornerRadius="{DynamicResource SplitButtonSpinnerLeftButtonCornerRadius}"
IsVisible="{TemplateBinding ShowButtonSpinner}"
Theme="{StaticResource ButtonSpinnerRepeatButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Classes="Small"
Data="{DynamicResource SplitButtonSpinnerDecreaseButtonGlyph}"
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
</RepeatButton>
<Border
Grid.Column="1"
Margin="2 0"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</Border>
<RepeatButton
Name="PART_IncreaseButton"
Grid.Column="2"
VerticalAlignment="Stretch"
Padding="{DynamicResource SplitButtonSpinnerButtonPadding}"
BorderBrush="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}"
BorderThickness="{DynamicResource ButtonSpinnerButtonGroupBorderThickness}"
CornerRadius="{DynamicResource SplitButtonSpinnerRightButtonCornerRadius}"
IsVisible="{TemplateBinding ShowButtonSpinner}"
Theme="{StaticResource ButtonSpinnerRepeatButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Classes="Small"
Data="{DynamicResource SplitButtonSpinnerIncreaseButtonGlyph}"
Foreground="{DynamicResource ButtonSpinnerRepeatButtonForeground}" />
</RepeatButton>
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^:left /template/ RepeatButton#PART_DecreaseButton">
<Setter Property="Grid.Column" Value="2" />
<Setter Property="CornerRadius" Value="{DynamicResource SplitButtonSpinnerRightButtonCornerRadius}" />
</Style>
<Style Selector="^:left /template/ RepeatButton#PART_IncreaseButton">
<Setter Property="Grid.Column" Value="0" />
<Setter Property="CornerRadius" Value="{DynamicResource SplitButtonSpinnerLeftButtonCornerRadius}" />
</Style>
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -9,7 +9,6 @@
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker"> <ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" /> <Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" /> <Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalendarDatePickerCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource CalendarDatePickerCornerRadius}" />
@@ -53,9 +52,8 @@
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource NonErrorTextBox}" Theme="{DynamicResource NonErrorTextBox}"
UseFloatingPlaceholder="{TemplateBinding UseFloatingPlaceholder}" UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
PlaceholderForeground="{TemplateBinding PlaceholderForeground}" Watermark="{TemplateBinding Watermark}">
PlaceholderText="{TemplateBinding PlaceholderText}">
<TextBox.Styles> <TextBox.Styles>
<Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder"> <Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own focused state, override this to disable it here --> <!-- By default the TextBox has its own focused state, override this to disable it here -->

View File

@@ -0,0 +1,112 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<CaptionButtons />
</Design.PreviewWith>
<ControlTheme x:Key="CaptionButton" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="{StaticResource CaptionButtonCornerRadius}" />
<Setter Property="Padding" Value="{StaticResource CaptionButtonPadding}" />
<Setter Property="Width" Value="{StaticResource CaptionButtonWidth}" />
<Setter Property="Height" Value="{StaticResource CaptionButtonHeight}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressedBackground}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type CaptionButtons}" TargetType="CaptionButtons">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="CaptionButtons">
<StackPanel Orientation="Horizontal">
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
<PathIcon
Name="PART_FullScreenButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowExpandGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button
Name="PART_MinimizeButton"
Theme="{StaticResource CaptionButton}"
AutomationProperties.Name="Minimize"
Win32Properties.NonClientHitTestResult="MinButton">
<PathIcon
Name="PART_MinimizeButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowMinimizeGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button
Name="PART_RestoreButton"
Theme="{StaticResource CaptionButton}"
AutomationProperties.Name="Maximize"
Win32Properties.NonClientHitTestResult="MaxButton">
<PathIcon
Name="PART_RestoreButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowMaximizeGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
<Button
Name="PART_CloseButton"
Theme="{StaticResource CaptionButton}"
AutomationProperties.Name="Close"
Win32Properties.NonClientHitTestResult="Close">
<PathIcon
Name="PART_CloseButtonIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{StaticResource WindowCloseIconGlyph}"
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
</StackPanel>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ Button#PART_CloseButton:pointerover">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
</Style>
<Style Selector="^ /template/ Button#PART_CloseButton:pressed">
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonCloseForeground}" />
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePressedBackground}" />
</Style>
<Style Selector="^:maximized /template/ PathIcon#PART_RestoreButtonIcon">
<Setter Property="Data" Value="{StaticResource WindowRestoreGlyph}" />
</Style>
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
<Setter Property="Data" Value="{StaticResource WindowCollapseGlyph}" />
</Style>
<Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:fullscreen /template/ Button#PART_MinimizeButton">
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"> xmlns:converter="clr-namespace:Semi.Avalonia.Converters">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Spacing="20" Width="800" Height="800"> <StackPanel Spacing="20" Width="800" Height="800">
<StackPanel.Styles> <StackPanel.Styles>
@@ -156,7 +156,7 @@
Theme="{DynamicResource InnerPathIcon}" Theme="{DynamicResource InnerPathIcon}"
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
Data="{TemplateBinding Content}" Data="{DynamicResource CarouselButtonGlyph}"
Foreground="{TemplateBinding Foreground}" /> Foreground="{TemplateBinding Foreground}" />
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
@@ -197,8 +197,8 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}" ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
ItemsSource="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemToObjectConverter}}" ItemsSource="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemToObjectConverter}}"
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}" IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}"> SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
<ListBox.ItemsPanel> <ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
@@ -213,8 +213,7 @@
Theme="{DynamicResource CarouselButton}" Theme="{DynamicResource CarouselButton}"
Margin="{DynamicResource CarouselButtonMargin}" Margin="{DynamicResource CarouselButtonMargin}"
Foreground="{DynamicResource CarouselButtonForeground}" Foreground="{DynamicResource CarouselButtonForeground}"
Content="{StaticResource SemiIconChevronLeft}" IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}"
Command="{Binding $parent[Carousel].Previous}" /> Command="{Binding $parent[Carousel].Previous}" />
<Button <Button
Grid.Row="0" Grid.Row="0"
@@ -223,9 +222,9 @@
Theme="{DynamicResource CarouselButton}" Theme="{DynamicResource CarouselButton}"
Margin="{DynamicResource CarouselButtonMargin}" Margin="{DynamicResource CarouselButtonMargin}"
Foreground="{DynamicResource CarouselButtonForeground}" Foreground="{DynamicResource CarouselButtonForeground}"
Content="{StaticResource SemiIconChevronRight}" IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}" Command="{Binding $parent[Carousel].Next}"
Command="{Binding $parent[Carousel].Next}" /> RenderTransform="rotate(180deg)" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>

View File

@@ -1,19 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type CarouselPage}" TargetType="CarouselPage">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate TargetType="CarouselPage">
<Carousel
Name="PART_Carousel"
Background="{TemplateBinding Background}"
ItemTemplate="{TemplateBinding PageTemplate}"
PageTransition="{TemplateBinding PageTransition}"
ItemsPanel="{TemplateBinding ItemsPanel}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -92,7 +92,7 @@
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Text, Mode=TwoWay}" Text="{TemplateBinding Text, Mode=TwoWay}"
PlaceholderText="{TemplateBinding PlaceholderText}" Watermark="{TemplateBinding PlaceholderText}"
IsVisible="{TemplateBinding IsEditable}" /> IsVisible="{TemplateBinding IsEditable}" />
<Button <Button

View File

@@ -1,371 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:collections="clr-namespace:Avalonia.Collections;assembly=Avalonia.Base">
<Design.PreviewWith>
<GroupBox Height="500">
<GroupBox.Header>
<StackPanel>
<ComboBox
Name="lc"
ItemsSource="{DynamicResource LabelPositionList}"
SelectedValue="{x:Static CommandBarDefaultLabelPosition.Bottom}">
<ComboBox.Resources>
<collections:AvaloniaList x:TypeArguments="CommandBarDefaultLabelPosition" x:Key="LabelPositionList">
<CommandBarDefaultLabelPosition>Bottom</CommandBarDefaultLabelPosition>
<CommandBarDefaultLabelPosition>Collapsed</CommandBarDefaultLabelPosition>
<CommandBarDefaultLabelPosition>Right</CommandBarDefaultLabelPosition>
</collections:AvaloniaList>
</ComboBox.Resources>
</ComboBox>
<ToggleSwitch Name="idfe" IsChecked="True" />
<Slider Name="ws" Width="500" Minimum="0" Maximum="500" Value="200" />
</StackPanel>
</GroupBox.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<CommandBar
DefaultLabelPosition="{Binding #lc.SelectedValue}"
IsDynamicOverflowEnabled="{Binding #idfe.IsChecked}"
Width="{Binding #ws.Value}">
<CommandBarButton Label="New" Icon="{DynamicResource SemiIconPlus}" />
<CommandBarButton Label="Save" Icon="{DynamicResource SemiIconSave}" />
<CommandBarSeparator />
<CommandBarToggleButton Label="Bold" Icon="{DynamicResource SemiIconBold}" />
<CommandBarToggleButton Label="Italic" Icon="{DynamicResource SemiIconItalic}" />
<CommandBarToggleButton IsEnabled="False" IsChecked="True" Label="Underline" Icon="{DynamicResource SemiIconUnderline}" />
<CommandBarSeparator />
<CommandBarButton Label="Share" Icon="{DynamicResource SemiIconShare}" />
<CommandBarButton Label="Export" Icon="{DynamicResource SemiIconExport}" />
<CommandBarButton Label="Print" Icon="{DynamicResource SemiIconPrint}" />
<CommandBarSeparator />
<CommandBarButton Label="Delete" Icon="{DynamicResource SemiIconDelete}" />
</CommandBar>
</StackPanel>
</GroupBox>
</Design.PreviewWith>
<ControlTheme x:Key="CommandBarButtonBaseTheme" TargetType="Button">
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border
Name="PART_Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}">
<StackPanel
Name="PART_LayoutRoot"
Spacing="{DynamicResource CommandBarButtonPanelSpacing}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter
Name="PART_IconPresenter"
Foreground="{TemplateBinding Foreground}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="Geometry">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{Binding}" />
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
<TextBlock
Name="PART_Label"
MaxLines="1"
Foreground="{TemplateBinding Foreground}"
FontSize="{DynamicResource CommandBarButtonLabelFontSize}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</Border>
</ControlTemplate>
</Setter>
<Setter Property="Background" Value="{DynamicResource CommandBarButtonBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CommandBarButtonForeground}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="{DynamicResource CommandBarButtonPadding}" />
<Setter Property="Width" Value="{DynamicResource CommandBarButtonWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource CommandBarButtonMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource CommandBarButtonCornerRadius}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Style Selector="^:pointerover /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource CommandBarButtonPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource CommandBarButtonPressedBackground}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource CommandBarButtonDisabledForeground}" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="Foreground" Value="{DynamicResource CommandBarButtonDisabledForeground}" />
</Style>
</Style>
</ControlTheme>
<!-- CommandBarButton -->
<ControlTheme
x:Key="{x:Type CommandBarButton}"
BasedOn="{StaticResource CommandBarButtonBaseTheme}"
TargetType="CommandBarButton">
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="Text" Value="{TemplateBinding Label}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Content" Value="{TemplateBinding Icon}" />
</Style>
<!-- IsCompact: hide label, use compact width -->
<Style Selector="^[IsCompact=True]">
<Setter Property="Width" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
<!-- LabelPosition=Collapsed: hide label, use compact width -->
<Style Selector="^[LabelPosition=Collapsed]">
<Setter Property="Width" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
<!-- LabelPosition=Right: horizontal layout, auto-width -->
<Style Selector="^[LabelPosition=Right]">
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="MinWidth" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ StackPanel#PART_LayoutRoot">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Style>
<!-- IsInOverflow: full-width horizontal layout for use inside overflow popup -->
<Style Selector="^[IsInOverflow=True]">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="MinHeight" Value="{DynamicResource CommandBarButtonOverflowMinHeight}" />
<Setter Property="Padding" Value="{DynamicResource CommandBarButtonOverflowPadding}" />
<Style Selector="^ /template/ StackPanel#PART_LayoutRoot">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Style>
</ControlTheme>
<!-- CommandBarToggleButton -->
<ControlTheme
x:Key="{x:Type CommandBarToggleButton}"
BasedOn="{StaticResource CommandBarButtonBaseTheme}"
TargetType="CommandBarToggleButton">
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="Text" Value="{TemplateBinding Label}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Content" Value="{TemplateBinding Icon}" />
</Style>
<Style Selector="^:checked">
<Style Selector="^ /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource CommandBarToggleButtonCheckedBackground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource CommandBarToggleButtonCheckedForeground}" />
</Style>
<Style Selector="^:pointerover /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource CommandBarToggleButtonCheckedPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_Border">
<Setter Property="Background" Value="{DynamicResource CommandBarToggleButtonCheckedPressedBackground}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource CommandBarToggleButtonCheckedDisabledForeground}" />
</Style>
</Style>
<!-- IsCompact: hide label, use compact width -->
<Style Selector="^[IsCompact=True]">
<Setter Property="Width" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
<!-- LabelPosition=Collapsed: hide label, use compact width -->
<Style Selector="^[LabelPosition=Collapsed]">
<Setter Property="Width" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
<!-- LabelPosition=Right: horizontal layout, auto-width -->
<Style Selector="^[LabelPosition=Right]">
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="MinWidth" Value="{DynamicResource CommandBarButtonCompactWidth}" />
<Style Selector="^ /template/ StackPanel#PART_LayoutRoot">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Style>
<!-- IsInOverflow: full-width horizontal layout for use inside overflow popup -->
<Style Selector="^[IsInOverflow=True]">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="MinHeight" Value="{DynamicResource CommandBarButtonOverflowMinHeight}" />
<Setter Property="Padding" Value="{DynamicResource CommandBarButtonOverflowPadding}" />
<Style Selector="^ /template/ StackPanel#PART_LayoutRoot">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Label">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Style>
</ControlTheme>
<!-- CommandBarSeparator -->
<ControlTheme x:Key="{x:Type CommandBarSeparator}" TargetType="CommandBarSeparator">
<Setter Property="Background" Value="{DynamicResource CommandBarSeparatorBackground}" />
<Setter Property="Width" Value="{DynamicResource CommandBarSeparatorWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource CommandBarSeparatorMinHeight}" />
<Setter Property="Margin" Value="{DynamicResource CommandBarSeparatorMargin}" />
<Setter Property="Template">
<ControlTemplate TargetType="CommandBarSeparator">
<Border
Background="{TemplateBinding Background}"
Width="{TemplateBinding Width}"
MinHeight="{TemplateBinding MinHeight}" />
</ControlTemplate>
</Setter>
<!-- IsInOverflow: horizontal line separator -->
<Style Selector="^[IsInOverflow=True]">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="Height" Value="{DynamicResource CommandBarSeparatorOverflowHeight}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="{DynamicResource CommandBarSeparatorOverflowMargin}" />
</Style>
</ControlTheme>
<!-- CommandBar -->
<ControlTheme x:Key="{x:Type CommandBar}" TargetType="CommandBar">
<Setter Property="Background" Value="{DynamicResource CommandBarBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CommandBarForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CommandBarBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CommandBarBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CommandBarCornerRadius}" />
<Setter Property="MinHeight" Value="{DynamicResource CommandBarMinHeight}" />
<Setter Property="Padding" Value="{DynamicResource CommandBarPadding}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="CommandBar">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}">
<Panel>
<DockPanel KeyboardNavigation.TabNavigation="Cycle">
<!-- Overflow button (docked right) -->
<CommandBarButton
Name="PART_OverflowButton"
DockPanel.Dock="Right"
Icon="{DynamicResource CommandBarOverflowButtonGlyph}"
IsCompact="True"
IsVisible="{TemplateBinding IsOverflowButtonVisible}" />
<!-- Custom content (docked left) -->
<ContentPresenter
Name="PART_ContentPresenter"
DockPanel.Dock="Left"
Content="{TemplateBinding Content}"
VerticalAlignment="Center" />
<!-- Primary commands (fills remaining space, right-aligned) -->
<ItemsControl
Name="PART_PrimaryCommands"
ItemsSource="{Binding VisiblePrimaryCommands, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
ClipToBounds="True">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DockPanel>
<!-- Overflow popup -->
<Popup
Name="PART_OverflowPopup"
IsOpen="{TemplateBinding IsOpen, Mode=TwoWay}"
PlacementTarget="{Binding #PART_OverflowButton}"
Placement="Bottom"
IsLightDismissEnabled="True"
WindowManagerAddShadowHint="False">
<Border
MinHeight="{DynamicResource CommandBarOverflowMinHeight}"
MaxWidth="{DynamicResource CommandBarOverflowMaxWidth}"
MaxHeight="{DynamicResource CommandBarOverflowMaxHeight}"
Margin="{DynamicResource CommandBarOverflowMargin}"
Padding="{DynamicResource CommandBarOverflowPadding}"
Background="{DynamicResource CommandBarOverflowBackground}"
BorderBrush="{DynamicResource CommandBarOverflowBorderBrush}"
BorderThickness="{DynamicResource CommandBarBorderThickness}"
BoxShadow="{DynamicResource CommandBarOverflowBoxShadow}"
CornerRadius="{DynamicResource CommandBarOverflowCornerRadius}">
<ItemsControl
Name="PART_OverflowPresenter"
ItemsSource="{Binding OverflowItems, RelativeSource={RelativeSource TemplatedParent}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</Popup>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,42 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<ContentPage
Width="400"
Height="300"
Background="White">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="ContentPage" />
</ContentPage>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type ContentPage}" TargetType="ContentPage">
<Setter Property="Background" Value="{DynamicResource ContentPageBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ContentPageForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="ContentPage">
<DockPanel>
<ContentPresenter
Name="PART_TopCommandBar"
DockPanel.Dock="Top" />
<ContentPresenter
Name="PART_BottomCommandBar"
DockPanel.Dock="Bottom" />
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</DockPanel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -261,7 +261,7 @@
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonDisabledIconForeground}" /> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonDisabledIconForeground}" />
</Style> </Style>
<!-- Changes foreground for placeholder text when SelectedDate is null --> <!-- Changes foreground for watermark text when SelectedDate is null -->
<Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock"> <Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerEmptyForeground}" /> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerEmptyForeground}" />
</Style> </Style>

View File

@@ -1,252 +0,0 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<DrawerPage Width="400" Height="300" />
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type DrawerPage}" TargetType="DrawerPage">
<Setter Property="Background" Value="{DynamicResource DrawerPageBackground}" />
<Setter Property="Foreground" Value="{DynamicResource DrawerPageForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="DrawerPage">
<SplitView
Name="PART_SplitView"
CompactPaneLength="{TemplateBinding CompactDrawerLength}"
DisplayMode="{TemplateBinding DisplayMode}"
IsPaneOpen="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
OpenPaneLength="{TemplateBinding DrawerLength}"
PaneBackground="{Binding DrawerBackground, RelativeSource={RelativeSource TemplatedParent}}">
<SplitView.Pane>
<DockPanel Background="{TemplateBinding DrawerBackground}">
<!-- Compact-mode toggle: visible only in CompactOverlay/CompactInline. -->
<ToggleButton
Name="PART_CompactPaneToggle"
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">
<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}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentPresenter
Name="PART_DrawerHeader"
Background="{TemplateBinding DrawerHeaderBackground}"
Content="{TemplateBinding DrawerHeader}"
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}"
DockPanel.Dock="Top"
IsVisible="{TemplateBinding DrawerHeader,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_DrawerFooter"
Background="{TemplateBinding DrawerFooterBackground}"
Content="{TemplateBinding DrawerFooter}"
ContentTemplate="{TemplateBinding DrawerFooterTemplate}"
DockPanel.Dock="Bottom"
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">
<DockPanel Name="PART_ContentDock">
<Border
Name="PART_TopBar"
Height="{DynamicResource DrawerPageTopBarMinHeight}"
Padding="5"
Background="{DynamicResource DrawerPageTopBarBackground}"
DockPanel.Dock="Top">
<DockPanel HorizontalAlignment="Stretch">
<ToggleButton
Name="PART_PaneButton"
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">
<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
Name="PART_TitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
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"
IsVisible="False">
<DockPanel HorizontalAlignment="Stretch">
<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">
<Panel>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource DrawerPaneButtonIcon}"
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}"
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Panel>
</ToggleButton>
<ContentControl
Name="PART_BottomTitlePresenter"
Margin="8,0,0,0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Header}"
FontSize="16"
FontWeight="SemiBold"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
</DockPanel>
</Border>
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</DockPanel>
<Border
Name="PART_Backdrop"
Background="{TemplateBinding BackdropBrush}"
IsHitTestVisible="False"
IsVisible="False" />
</Grid>
</SplitView>
</ControlTemplate>
</Setter>
<Style Selector="^:placement-right /template/ ToggleButton#PART_PaneButton">
<Setter Property="DockPanel.Dock" Value="Right" />
</Style>
<!-- Bottom placement: swap top bar for bottom bar -->
<Style Selector="^:placement-bottom /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:placement-bottom /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="True" />
</Style>
<!-- Bottom placement + compact modes: pane compact strip provides toggle, hide bottom bar -->
<Style Selector="^:placement-bottom[DisplayMode=CompactOverlay] /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:placement-bottom[DisplayMode=CompactInline] /template/ Border#PART_BottomBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<!-- Horizontal pane (Bottom/Top): compact toggle must dock Left so drawer content can fill the rest -->
<Style Selector="^:placement-bottom /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="DockPanel.Dock" Value="Left" />
</Style>
<Style Selector="^:placement-top /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="DockPanel.Dock" Value="Left" />
</Style>
<Style Selector="^[DrawerBehavior=Locked] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DrawerBehavior=Disabled] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:detail-is-navpage /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactOverlay] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactOverlay] /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[DisplayMode=CompactInline] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^[DisplayMode=CompactInline] /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[IsInNavigationPage=True] /template/ Border#PART_TopBar">
<Setter Property="IsVisible" Value="False" />
</Style>
<!-- NavigationPage already hosts a hamburger toggle — suppress the compact pane toggle. -->
<Style Selector="^:detail-is-navpage /template/ ToggleButton#PART_CompactPaneToggle">
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -10,7 +10,7 @@
<Panel> <Panel>
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
<Border Background="{TemplateBinding Background}"> <Border Background="{TemplateBinding Background}">
<VisualLayerManager Name="PART_VisualLayerManager"> <VisualLayerManager>
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"

View File

@@ -1,5 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="{x:Type GroupBox}" ResourceKey="GroupBox"/>
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"> xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Spacing="20"> <StackPanel Spacing="20">
<HeaderedContentControl <HeaderedContentControl
@@ -23,6 +23,7 @@
</HeaderedContentControl> </HeaderedContentControl>
</StackPanel> </StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
<converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Indent="1" />
<ControlTheme x:Key="{x:Type HeaderedContentControl}" TargetType="HeaderedContentControl"> <ControlTheme x:Key="{x:Type HeaderedContentControl}" TargetType="HeaderedContentControl">
<Setter Property="Padding" Value="3" /> <Setter Property="Padding" Value="3" />
@@ -96,7 +97,7 @@
Name="SeparatorBorder" Name="SeparatorBorder"
Grid.Row="1" Grid.Row="1"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness, Converter={iri:ThicknessMixerConverter Top}}"> BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}">
<Border.IsVisible> <Border.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}"> <MultiBinding Converter="{x:Static BoolConverters.And}">
<TemplateBinding Property="Header" Converter="{x:Static ObjectConverters.IsNotNull}" /> <TemplateBinding Property="Header" Converter="{x:Static ObjectConverters.IsNotNull}" />
@@ -116,13 +117,5 @@
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="RecognizesAccessKey" Value="True" />
</Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,9 +1,9 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared" xmlns:converters="using:Semi.Avalonia.Converters"
xmlns:dialogs="using:Avalonia.Dialogs" xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"
xmlns:internal="using:Avalonia.Dialogs.Internal" xmlns:internal="clr-namespace:Avalonia.Dialogs.Internal;assembly=Avalonia.Dialogs"
xmlns:cvt="using:Avalonia.Controls.Converters"> xmlns:cvt="using:Avalonia.Controls.Converters">
<Design.PreviewWith> <Design.PreviewWith>
<Border <Border
@@ -14,11 +14,11 @@
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<iri:ResourceConverter x:Key="Icons"> <converters:KeyToPathConverter x:Key="Icons">
<StreamGeometry x:Key="Icon_Folder">M19,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4H10L12,6H19A2,2 0 0,1 21,8H21L4,8V18L6.14,10H23.21L20.93,18.5C20.7,19.37 19.92,20 19,20Z</StreamGeometry> <StreamGeometry x:Key="Icon_Folder">M19,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4H10L12,6H19A2,2 0 0,1 21,8H21L4,8V18L6.14,10H23.21L20.93,18.5C20.7,19.37 19.92,20 19,20Z</StreamGeometry>
<StreamGeometry x:Key="Icon_File">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z</StreamGeometry> <StreamGeometry x:Key="Icon_File">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z</StreamGeometry>
<StreamGeometry x:Key="Icon_Volume">M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z</StreamGeometry> <StreamGeometry x:Key="Icon_Volume">M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z</StreamGeometry>
</iri:ResourceConverter> </converters:KeyToPathConverter>
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}" TargetType="dialogs:ManagedFileChooser"> <ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}" TargetType="dialogs:ManagedFileChooser">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate x:DataType="internal:ManagedFileChooserViewModel" TargetType="dialogs:ManagedFileChooser"> <ControlTemplate x:DataType="internal:ManagedFileChooserViewModel" TargetType="dialogs:ManagedFileChooser">
@@ -77,7 +77,7 @@
<TextBox <TextBox
IsVisible="{Binding !SelectingFolder}" IsVisible="{Binding !SelectingFolder}"
Text="{Binding FileName}" Text="{Binding FileName}"
PlaceholderText="{DynamicResource STRING_CHOOSER_FILE_NAME}" /> Watermark="{DynamicResource STRING_CHOOSER_FILE_NAME}" />
</DockPanel> </DockPanel>
<CheckBox <CheckBox
VerticalAlignment="Center" VerticalAlignment="Center"

View File

@@ -54,17 +54,4 @@
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</ControlTheme> </ControlTheme>
<ControlTheme
x:Key="HorizontalMenuFlyoutPresenter"
TargetType="MenuFlyoutPresenter"
BasedOn="{StaticResource {x:Type MenuFlyoutPresenter}}">
<Setter Property="Padding" Value="0" />
<Setter Property="MinWidth" Value="{DynamicResource HorizontalMenuFlyoutThemeMinWidth}" />
<Setter Property="ItemsPanel">
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,123 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<NavigationPage Width="400" Height="300" />
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type NavigationPage}" TargetType="NavigationPage">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarMinHeight}" />
<Setter Property="Template">
<ControlTemplate TargetType="NavigationPage">
<Panel ClipToBounds="True">
<DockPanel>
<Border
Name="PART_NavBarSpacer"
Height="{TemplateBinding EffectiveBarHeight}"
IsVisible="False"
DockPanel.Dock="Top" />
<ContentPresenter
Name="PART_BottomCommandBar"
DockPanel.Dock="Bottom"
Background="{TemplateBinding Background}"
Content="{Binding CurrentPage.(NavigationPage.BottomCommandBar), RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}" />
<Panel
Name="PART_ContentHost"
Background="{TemplateBinding Background}"
ClipToBounds="True">
<ContentPresenter Name="PART_PageBackPresenter" />
<ContentPresenter Name="PART_PagePresenter" />
</Panel>
</DockPanel>
<Border
Name="PART_NavigationBar"
VerticalAlignment="Top"
MinHeight="{TemplateBinding EffectiveBarHeight}"
Padding="{DynamicResource NavigationPageBarPadding}"
Background="{DynamicResource NavigationPageBarBackground}"
BorderBrush="{DynamicResource NavigationPageBarBorderBrush}"
BorderThickness="{DynamicResource NavigationPageBarBorderThickness}">
<Grid ColumnDefinitions="Auto,*,Auto">
<Button
Name="PART_BackButton"
Grid.Column="0"
Classes="Tertiary"
Height="{TemplateBinding BarHeight}"
Width="{TemplateBinding BarHeight}"
Padding="8"
IsVisible="{TemplateBinding IsBackButtonEffectivelyVisible}"
Theme="{StaticResource BorderlessButton}">
<Panel Background="Transparent">
<PathIcon
Name="PART_BackButtonDefaultIcon"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource NavigationPageBackButtonGlyph}" />
<ContentPresenter
Name="PART_BackButtonContentPresenter"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Panel>
</Button>
<ContentPresenter
Name="PART_Header"
Grid.Column="1"
FontWeight="SemiBold"
Content="{Binding CurrentPage?.Header, RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}"
ContentTemplate="{Binding CurrentPage?.HeaderTemplate, RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}"
VerticalAlignment="Center"
Margin="12,0" />
<ContentPresenter
Name="PART_TopCommandBar"
Grid.Column="2"
HorizontalAlignment="Right"
Content="{Binding CurrentPage?.(NavigationPage.TopCommandBar), RelativeSource={RelativeSource TemplatedParent}, FallbackValue={x:Null}}" />
</Grid>
</Border>
<Border
Name="PART_NavBarShadow"
ZIndex="1"
VerticalAlignment="Top"
IsVisible="False"
Height="4"
IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="#0C000000" Offset="0" />
<GradientStop Color="#00000000" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<ContentPresenter
Name="PART_ModalBackPresenter"
ZIndex="99"
IsVisible="False"
Background="{TemplateBinding Background}" />
<ContentPresenter
Name="PART_ModalPresenter"
ZIndex="100"
IsVisible="False"
Background="{TemplateBinding Background}" />
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ Border#PART_NavigationBar">
<Setter Property="Background" Value="{DynamicResource NavigationBarBackground}" />
</Style>
<Style Selector="^:nav-bar-inset /template/ Border#PART_NavBarSpacer">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:nav-bar-compact /template/ ContentPresenter#PART_TopCommandBar CommandBar">
<Setter Property="DefaultLabelPosition" Value="Collapsed" />
</Style>
<Style Selector="^.Large">
<Setter Property="BarHeight" Value="{DynamicResource NavigationPageBarLargeMinHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -6,7 +6,6 @@
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownDefaultHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource NumericUpDownDefaultHeight}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="NumericUpDown"> <ControlTemplate TargetType="NumericUpDown">
<DataValidationErrors> <DataValidationErrors>
@@ -39,8 +38,7 @@
Theme="{DynamicResource NonErrorTextBox}" Theme="{DynamicResource NonErrorTextBox}"
InnerLeftContent="{TemplateBinding InnerLeftContent}" InnerLeftContent="{TemplateBinding InnerLeftContent}"
InnerRightContent="{TemplateBinding InnerRightContent}" InnerRightContent="{TemplateBinding InnerRightContent}"
PlaceholderForeground="{TemplateBinding PlaceholderForeground}" Watermark="{TemplateBinding Watermark}" />
PlaceholderText="{TemplateBinding PlaceholderText}" />
</ButtonSpinner> </ButtonSpinner>
</DataValidationErrors> </DataValidationErrors>
</ControlTemplate> </ControlTemplate>
@@ -53,15 +51,6 @@
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownSmallHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource NumericUpDownSmallHeight}" />
</Style> </Style>
<Style Selector="^.Split">
<Style Selector="^ /template/ ButtonSpinner#PART_Spinner">
<Setter Property="Theme" Value="{DynamicResource SplitButtonSpinner}" />
</Style>
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="CornerRadius" Value="0" />
</Style>
</Style>
<Style Selector="^:error"> <Style Selector="^:error">
<Style Selector="^ /template/ TextBox#PART_TextBox"> <Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" /> <Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />

View File

@@ -1,130 +0,0 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<StackPanel Margin="20" >
<PipsPager NumberOfPages="10" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="PipsPagerButton" TargetType="Button">
<Setter Property="Width" Value="24" />
<Setter Property="Height" Value="24" />
<Setter Property="Foreground" Value="{DynamicResource PipsPagerButtonForeground}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Data="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ PathIcon">
<Setter Property="Foreground" Value="{DynamicResource PipsPagerButtonPointeroverForeground}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="PipsPagerIndicatorDotListBoxItem" TargetType="ListBoxItem">
<Setter Property="Foreground" Value="{DynamicResource PipsPagerIndicatorForeground}" />
<Setter Property="Margin" Value="4" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="ListBoxItem">
<Ellipse
Name="Container"
Width="{DynamicResource CarouselIndicatorDotWidth}"
Height="{DynamicResource CarouselIndicatorDotHeight}"
Fill="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Foreground" Value="{DynamicResource PipsPagerIndicatorPointeroverForeground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Foreground" Value="{DynamicResource PipsPagerIndicatorPressedForeground}" />
</Style>
<Style Selector="^:selected">
<Setter Property="Foreground" Value="{DynamicResource PipsPagerIndicatorSelectedForeground}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type PipsPager}" TargetType="PipsPager">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="PreviousButtonTheme" Value="{StaticResource PipsPagerButton}" />
<Setter Property="NextButtonTheme" Value="{StaticResource PipsPagerButton}" />
<Setter Property="Template">
<ControlTemplate>
<StackPanel
Name="PART_RootPanel"
Orientation="{TemplateBinding Orientation}"
Background="{TemplateBinding Background}"
ClipToBounds="False">
<Button
Name="PART_PreviousButton"
Theme="{TemplateBinding PreviousButtonTheme}"
IsVisible="{TemplateBinding IsPreviousButtonVisible}"
Foreground="{DynamicResource PipsPagerButtonForeground}"
Content="{StaticResource SemiIconSmallTriangleLeft}" />
<ListBox
Name="PART_PipsPagerList"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
ItemsSource="{Binding TemplateSettings.Pips, RelativeSource={RelativeSource TemplatedParent}}"
SelectedIndex="{TemplateBinding SelectedPageIndex, Mode=TwoWay}"
AutoScrollToSelectedItem="False"
ItemContainerTheme="{StaticResource PipsPagerIndicatorDotListBoxItem}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="{Binding $parent[PipsPager].Orientation}" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<Button
Name="PART_NextButton"
Theme="{TemplateBinding NextButtonTheme}"
Foreground="{DynamicResource PipsPagerButtonForeground}"
Content="{StaticResource SemiIconSmallTriangleRight}"
IsVisible="{TemplateBinding IsNextButtonVisible}" />
</StackPanel>
</ControlTemplate>
</Setter>
<Style Selector="^:horizontal /template/ StackPanel#PART_RootPanel">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style Selector="^:vertical">
<Style Selector="^ /template/ StackPanel#PART_RootPanel">
<Setter Property="Orientation" Value="Vertical" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style Selector="^ /template/ Button#PART_PreviousButton">
<Setter Property="Content" Value="{DynamicResource SemiIconSmallTriangleTop}" />
</Style>
<Style Selector="^ /template/ Button#PART_NextButton">
<Setter Property="Content" Value="{DynamicResource SemiIconSmallTriangleDown}" />
</Style>
</Style>
<Style Selector="^:first-page /template/ Button#PART_PreviousButton">
<Setter Property="Opacity" Value="0" />
<Setter Property="IsHitTestVisible" Value="False" />
</Style>
<Style Selector="^:last-page /template/ Button#PART_NextButton">
<Setter Property="Opacity" Value="0" />
<Setter Property="IsHitTestVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -13,7 +13,7 @@
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> <LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<Panel> <Panel>
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
<VisualLayerManager Name="PART_VisualLayerManager"> <VisualLayerManager IsPopup="True">
<LayoutTransformControl Name="PART_LayoutTransform"> <LayoutTransformControl Name="PART_LayoutTransform">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
@@ -37,7 +37,7 @@
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> <LayoutTransformControl LayoutTransform="{TemplateBinding Transform}">
<VisualLayerManager Name="PART_VisualLayerManager"> <VisualLayerManager IsPopup="True">
<LayoutTransformControl Name="PART_LayoutTransform"> <LayoutTransformControl Name="PART_LayoutTransform">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"

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