Compare commits

..

96 Commits

Author SHA1 Message Date
rabbitism
8827491546 feat: enable vulkan in android demo. 2024-08-23 11:05:08 +08:00
Dong Bin
e2420121eb Merge pull request #420 from irihitech/drm
Upgrade DRM project to net8
2024-08-19 15:48:49 +08:00
Zhang Dian
67ddbc1598 feat: update DRM README docs. 2024-08-18 19:42:07 +08:00
Zhang Dian
e9f74ef3ed feat: upgrade DRM project to net8. 2024-08-18 17:51:59 +08:00
Zhang Dian
dd042fd810 Merge pull request #418 from irihitech/version
Upgrade to 11.1.0.2
2024-08-16 15:41:02 +08:00
Zhang Dian
ea79b0812e misc: bump version. 2024-08-16 14:30:03 +08:00
Zhang Dian
421e8ec53f Merge pull request #417 from irihitech/grid
feat: respect AllowAutoHide in DataGrid.
2024-08-15 18:54:06 +08:00
Zhang Dian
b80deac692 feat:add AutoHide ToggleSwitch to DataGrid demo. 2024-08-15 18:53:06 +08:00
rabbitism
a3ed11fa10 feat: respect AllowAutoHide in DataGrid. 2024-08-15 17:41:31 +08:00
Dong Bin
b13547ae23 Merge pull request #416 from irihitech/notification
Enhance Notification
2024-08-14 22:22:43 +08:00
Zhang Dian
1b26941ec9 fix: revert commit. 2024-08-14 20:52:40 +08:00
Zhang Dian
6630d04565 feat: enhance NotificationDemo. 2024-08-14 20:50:54 +08:00
Zhang Dian
a328e2bb99 feat: add Light class to NotificationCard. 2024-08-14 20:00:43 +08:00
Zhang Dian
38b9494aaf feat: enhance NotificationCard. 2024-08-14 19:22:17 +08:00
Dong Bin
ecde71c999 Merge pull request #411 from irihitech/colorPicker
Enhance ColorPicker
2024-08-13 23:34:42 +08:00
Zhang Dian
f9ce88fbc3 Merge pull request #408 from Darth-Lexx/main
RU locale
2024-08-13 17:09:10 +08:00
Zhang Dian
9b9c05773b fix: fix issues. 2024-08-13 14:45:10 +08:00
Zhang Dian
4d3c9630c3 fix: fix Flyout Placement. 2024-08-12 16:35:51 +08:00
Zhang Dian
73687eb72f fix: fix the shake of ColorSpectrum's thumb. 2024-08-12 16:00:14 +08:00
Zhang Dian
e8d28c0233 feat: add SimpleColorPicker & HexSimpleColorPicker. 2024-08-12 14:42:47 +08:00
Zhang Dian
1cedc77ce1 feat: complete SimpleColorView. 2024-08-12 14:40:57 +08:00
Dong Bin
18fa51a572 Merge branch 'main' into main 2024-08-10 16:45:01 +08:00
Dong Bin
d3a933804b Merge pull request #409 from gehongyan/jp-localization
Add ja_jp Localization
2024-08-10 16:43:55 +08:00
Zhang Dian
d2a1f1e277 feat: basic SimpleColorView. 2024-08-10 14:54:32 +08:00
Zhang Dian
3c0497c07a fix: set ComboBox icon Width Auto, remove a column of CalendarDatePicker 2024-08-10 14:23:11 +08:00
Zhang Dian
4d89b82e16 fix: fix the issue of RGB & HSV NumericUpDown Tag disappearing. 2024-08-10 13:20:13 +08:00
Gehongyan
f564c98afd feat: ja-jp localization 2024-08-10 00:25:02 +08:00
Dong Bin
472f91fab2 Merge pull request #407 from irihitech/popup
Fix Popup related control Background color in Dark Mode
2024-08-08 16:54:49 +08:00
Dong Bin
f55faad641 Merge pull request #406 from irihitech/innerbutton
Fix TextBox Inner Button issues
2024-08-08 16:45:07 +08:00
Dong Bin
1b5a5d5ea1 Merge pull request #405 from irihitech/adorner
Update AdornerLayer
2024-08-08 16:17:14 +08:00
Dong Bin
a81dcb20c5 Merge pull request #400 from MakesYT/expander
修改Expander默认内容为占满宽度
2024-08-08 16:03:42 +08:00
Zhang Dian
95744b7a64 fix: fix Popup related control Background color. 2024-08-07 17:17:54 +08:00
Zhang Dian
7a6c42e106 fix: ClearButton will take the icon place when TextBox has value. 2024-08-07 16:17:22 +08:00
Zhang Dian
4b71b18e72 fix: TextBox inner button colors. 2024-08-07 16:14:32 +08:00
Zhang Dian
3849d7efeb feat: update ToggleSwitch AdornerLayer. 2024-08-07 12:07:56 +08:00
Zhang Dian
5644cf59dc feat: update Default AdornerLayer style. 2024-08-07 12:06:13 +08:00
Dong Bin
372e5d3410 Merge pull request #404 from irihitech/switch
Enchance ToggleSwitch
2024-08-06 19:35:34 +08:00
Zhang Dian
3af7e2f29a feat: add OnContent & OffContent to SimpleToggleSwitch. 2024-08-06 16:42:55 +08:00
Zhang Dian
d355410ff2 feat: add Loading Classes. 2024-08-06 15:22:49 +08:00
Алексей Родионов
a28cbf5ac2 RU locale 2024-08-05 22:13:50 +03:00
rabbitism
fae4a32507 misc: bump version. 2024-08-04 01:15:13 +08:00
Dong Bin
7698f92320 Merge pull request #402 from irihitech/locale
Make sure locale dictionary is linked to class
2024-08-03 00:09:01 +08:00
rabbitism
8ad89d094e feat: make sure locale dictionary is linked to class. 2024-08-02 23:13:36 +08:00
MakesYT
259f8cb5bd Merge branch 'irihitech:main' into expander 2024-08-02 15:41:19 +08:00
Dong Bin
e336800bd5 Merge pull request #398 from irihitech/issue/394-spinner
Remove NumericUpDown ContextFlyout redundant arrow buttons
2024-08-01 18:27:19 +08:00
Zhang Dian
fdd4c99210 Merge pull request #396 from MakesYT/main
独立背景颜色为资源
2024-08-01 17:45:02 +08:00
Zhang Dian
2957521ef8 fix: remove NumericUpDown ContextFlyout redundant arrow buttons. 2024-08-01 17:06:35 +08:00
MakesYT
7c63d45d5e 修改 expander默认HorizontalContentAlignment为Stretch 2024-07-28 17:46:36 +08:00
MakesYT
e1bef9fd04 同步Light 颜色 2024-07-28 15:36:42 +08:00
MakesYT
d90d7b9fe1 独立背景颜色为资源 2024-07-28 14:17:50 +08:00
Dong Bin
1c0a3c7359 Merge pull request #392 from irihitech/11.1.0
Upgrade to 11.1.0
2024-07-23 16:34:46 +08:00
Zhang Dian
2e2f183ed8 misc: upgrade package version. 2024-07-23 15:14:57 +08:00
Zhang Dian
ad7bcfc520 misc: README & Overview page. 2024-07-23 14:57:21 +08:00
Zhang Dian
b930a2dcf1 misc: upgrade to 11.1.0 Android template. 2024-07-23 14:24:00 +08:00
Zhang Dian
2b39f14bba misc: new web template. 2024-07-23 13:34:26 +08:00
Zhang Dian
88d834ac3a misc: upgrade to Avalonia 11.1.0. 2024-07-23 13:26:18 +08:00
Dong Bin
0cc40c09c9 Merge pull request #389 from irihitech/rc2.1
Ready for 11.1.0-rc2.1
2024-07-19 00:00:05 +08:00
Zhang Dian
0d8ea070cc misc: update dependency. 2024-07-18 23:31:27 +08:00
Dong Bin
d959ef234c Merge pull request #388 from irihitech/trim
Fix the issue of ComboBoxDemoViewModel being trimmed
2024-07-18 22:20:38 +08:00
Zhang Dian
8ebc6878b1 fix: fix the issue of ComboBoxDemoViewModel being trimmed. 2024-07-18 22:16:38 +08:00
Zhang Dian
9d2b2d37e2 Merge pull request #387 from irihitech/trim
Enable trimming
2024-07-18 18:50:49 +08:00
Zhang Dian
8982e610e2 feat: add doc & GitHub repo link buttons. 2024-07-18 18:36:07 +08:00
rabbitism
31e2c009fb feat: remove useless files. 2024-07-18 17:56:15 +08:00
rabbitism
9259f06f57 fix: fix palette trimming issue. 2024-07-18 16:58:05 +08:00
rabbitism
724a528b16 feat: try to fix trimming compatibility. 2024-07-18 16:45:50 +08:00
Dong Bin
09d23f8eaa Merge pull request #386 from irihitech/switch
Add size Classes to ToggleSwitch
2024-07-18 14:08:59 +08:00
Zhang Dian
d3c909a83c feat: add size Classes to ToggleSwitch. 2024-07-16 23:47:16 +08:00
Dong Bin
b505445b77 Merge pull request #384 from irihitech/issue/365
Unify Calendar MinHeight/Width in default Theme
2024-07-16 20:54:12 +08:00
Dong Bin
74c1b2f2ee Merge pull request #383 from irihitech/issue/375
Extract DataGrid & TreeDataGrid Margin
2024-07-16 20:53:53 +08:00
Zhang Dian
8afe3a87bd feat: unify Calendar MinHeight/Width in default Theme. 2024-07-15 22:43:09 +08:00
Zhang Dian
b5f4bacece feat: extract DataGrid & TreeDataGrid Margin. 2024-07-15 22:37:15 +08:00
Dong Bin
c46e6b9cf9 Merge pull request #382 from irihitech/issue/381
Button new Theme & Typography colors
2024-07-15 18:04:17 +08:00
Zhang Dian
ccc25b4801 feat: CheckBox :pressed Background. 2024-07-15 15:43:18 +08:00
Dong Bin
e6541b4741 Merge pull request #380 from irihitech/issue/379
Add Danger Classes to replace Error Classes in ProgressBar.
2024-07-15 11:52:23 +08:00
Zhang Dian
c4f5754129 fix: fix SplitButton :pressed Background. 2024-07-15 03:08:06 +08:00
Zhang Dian
d7fce5c180 feat: Typography. 2024-07-15 02:39:10 +08:00
Zhang Dian
4f685c712a feat: ToggleButton & ToggleSplitButton :checked. 2024-07-15 01:12:44 +08:00
Zhang Dian
1378219b7a feat: RepeatButton. 2024-07-15 00:33:28 +08:00
Zhang Dian
0979141f54 feat: :disabled, Tertiary Classes Button color. 2024-07-15 00:16:38 +08:00
Zhang Dian
6a94e403c9 feat: add Outline Theme to Button. 2024-07-14 22:26:59 +08:00
Zhang Dian
2da1ecf5a0 feat: add Danger Classes to replace Error Classes in ProgressBar. 2024-07-13 15:15:03 +08:00
Dong Bin
915c45c21f Merge pull request #377 from zdpcdt/font
Web demo font
2024-07-11 10:17:08 +08:00
Zhang Dian
db137ef718 feat: web demo font. 2024-07-11 03:17:15 +08:00
Dong Bin
f66edd5782 Merge pull request #376 from zdpcdt/main
fix Web Demo publish issue
2024-07-10 22:35:58 +08:00
Zhang Dian
5b48f77dfb fix: web demo publish issue. 2024-07-10 18:36:51 +08:00
Dong Bin
a225feeb0d Merge pull request #371 from irihitech/workflow
Update workflow version
2024-07-04 18:38:35 +08:00
rabbitism
99ddfcc952 misc: use lowercase culture name. 2024-07-01 20:41:14 +08:00
Zhang Dian
0daa884003 feat: update workflow version. 2024-07-01 18:24:09 +08:00
Dong Bin
93df1abf4a Merge pull request #370 from irihitech/various
Ready to version 11.1.0
2024-07-01 13:41:03 +08:00
Zhang Dian
942229acdc feat: dotnet7->dotnet8, restore font weight. 2024-07-01 12:43:29 +08:00
rabbitism
139c0b926c misc: update dependency. update documentation. 2024-06-28 22:34:34 +08:00
Zhang Dian
694dd863fa feat: add active colors to palette 2024-06-27 18:42:29 +08:00
Zhang Dian
b378cdf880 Merge pull request #369 from gehongyan/fix-disableglyph
Fix CheckBoxGlyphDisabledFill does not work
2024-06-27 10:24:50 +08:00
Gehongyan
57646f5390 fix: fix CheckBoxGlyphDisabledFill does not work
Issue #368
2024-06-26 11:34:32 +08:00
Zhang Dian
9e5d5298c4 Merge pull request #367 from irihitech/issue/359
Fix TopLevelMenuItem HeaderTemplate
2024-06-24 21:38:30 +08:00
Zhang Dian
0fb1e585db fix: fix TopLevelMenuItem HeaderTemplate. 2024-06-24 16:54:15 +08:00
139 changed files with 2343 additions and 789 deletions

View File

@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
env:
PROJECT_PATH: demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj
OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/bin/Release/net7.0/browser-wasm/AppBundle
OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/bin/Release/net8.0-browser/publish/wwwroot
on:
push:
branches: [ "action/deploy" ]
@@ -16,19 +16,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup .NET 7
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.405
dotnet-version: 8.0.x
- name: Install wasm-tools
run: dotnet workload install wasm-tools wasm-tools-net7
- name: Install DotNetCompress
run: dotnet tool install --global DotNetCompress --version 3.0.0 --no-cache
run: dotnet workload install wasm-tools
- name: Publish .NET Project
run: dotnet publish $PROJECT_PATH -c Release -o release --nologo
run: dotnet publish $PROJECT_PATH -c Release --nologo
- name: Change base-tag in index.html
run: sed -i 's/<base href="\/" \/>/<base href="\/Semi.Avalonia\/" \/>/g' $OUTPUT_PATH/index.html
@@ -36,12 +33,6 @@ jobs:
- name: copy index.html to 404.html
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
- name: Compress Output using Brotli
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format br --threads 4
- name: Compress Output using GZip
run: DotNetCompress -d $OUTPUT_PATH -p "*.dll" "*.js" "*.wasm" --format gz --threads 4
- name: Add .nojekyll file
run: touch $OUTPUT_PATH/.nojekyll

View File

@@ -49,7 +49,7 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet publish ./demo/Semi.Avalonia.Demo.Android -c Release -f net7.0-android --no-restore
run: dotnet publish ./demo/Semi.Avalonia.Demo.Android -c Release -f net8.0-android --no-restore
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1

View File

@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SC-Single" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="win-x64" self_contained="true" target_folder="$PROJECT_DIR$/demo/Semi.Avalonia.Demo.Desktop/bin/Release/net7.0/win-x64/publish" target_framework="net7.0" uuid_high="3088527218258560748" uuid_low="-8649338673481336678" />
<riderPublish configuration="Release" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="win-x64" self_contained="true" target_folder="$PROJECT_DIR$/demo/Semi.Avalonia.Demo.Desktop/bin/Release/net8.0/win-x64/publish" target_framework="net8.0" uuid_high="3088527218258560748" uuid_low="-8649338673481336678" />
<method v="2" />
</configuration>
</component>

View File

@@ -7,6 +7,10 @@
Avalonia Theme inspired by Semi Design
Semi.Avalonia can be previewed in the browser [here](https://irihitech.github.io/Semi.Avalonia/)
If you are looking for more detailed documentation, Please visit [Semi Documentation](https://docs.irihi.tech/semi/)
If you are looking for more customized controls, Please try [Ursa](https://github.com/irihitech/Ursa.Avalonia)
![Light](./docs/demo.jpg)
@@ -16,14 +20,16 @@ If you are looking for more customized controls, Please try [Ursa](https://githu
### Installation
```bash
dotnet add package Semi.Avalonia --version 11.0.7
dotnet add package Semi.Avalonia
```
Include Semi Design Styles in application:
```xaml
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" />
</Application.Styles>
```
@@ -32,9 +38,9 @@ That's all.
ColorPicker, DataGrid and TreeDataGrid are distributed in separated packages. Please install if you need.
```bash
dotnet add package Semi.Avalonia.ColorPicker --version 11.0.7
dotnet add package Semi.Avalonia.DataGrid --version 11.0.7
dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.7
dotnet add package Semi.Avalonia.ColorPicker
dotnet add package Semi.Avalonia.DataGrid
dotnet add package Semi.Avalonia.TreeDataGrid
```
```xaml
@@ -45,36 +51,6 @@ dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.7
</Application.Styles>
```
If AOT publishing is required, you need to include the rd.xml file in your project:
```xml
<ItemGroup>
<RdXmlFile Include="rd.xml"/>
</ItemGroup>
```
The contents of the rd.xml file should be as follows:
```xml
<?xml version="1.0" encoding="utf-8"?>
<Directives>
<!--
This file is part of RdXmlLibrary project.
Visit https://github.com/kant2002/rdxmllibrary for latest version.
If you have modifications specific to this Nuget package,
please contribute back.
-->
<Application>
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia" Dynamic="Required All"/>
<!-- If you don't use these, please don't include them.
<Assembly Name="Semi.Avalonia.DataGrid" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia.ColorPicker" Dynamic="Required All"/>
-->
</Application>
</Directives>
```
## Demo
You can always download demo executable to play around with Semi Avalonia Themes.
@@ -90,13 +66,10 @@ We offer limited free community support for Semi Avalonia and Ursa. If you have
| Semi Design Version | Avalonia Version |
|:--------------------|:-----------------|
| 11.1.0 | >=11.1.0 |
| 11.0.7 | >=11.0.7 |
| 11.0.1 | <=11.0.6 |
## TODO
* FocusAdorner
## Credits
[Semi Design](https://semi.design/)

View File

@@ -7,6 +7,10 @@
Avalonia UI 控件主题,灵感来自 Semi Design
Semi.Avalonia 现在可以在浏览器上 [查看效果](https://irihitech.github.io/Semi.Avalonia/)
如果您希望查看更详细的文档,请浏览 [Semi 文档](https://docs.irihi.tech/semi/)
如果您希望使用更多的拓展控件,欢迎尝试 [Ursa](https://github.com/irihitech/Ursa.Avalonia)
![Light](./docs/demo.jpg)
@@ -16,25 +20,27 @@ Avalonia UI 控件主题,灵感来自 Semi Design
### 安装
```bash
dotnet add package Semi.Avalonia --version 11.0.7
dotnet add package Semi.Avalonia
```
在样式中引用 Semi 主题:
```xaml
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<!-- 您仍然可以使用旧版方式引用 -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" />
</Application.Styles>
```
这样就可以了。
ColorPicker DataGrid 和 TreeDataGrid 的样式单独分发,如果需要请安装并引用。
ColorPickerDataGrid 和 TreeDataGrid 的样式单独分发,如果需要请安装并引用。
```bash
dotnet add package Semi.Avalonia.ColorPicker --version 11.0.7
dotnet add package Semi.Avalonia.DataGrid --version 11.0.7
dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.7
dotnet add package Semi.Avalonia.ColorPicker
dotnet add package Semi.Avalonia.DataGrid
dotnet add package Semi.Avalonia.TreeDataGrid
```
```xaml
@@ -45,36 +51,6 @@ dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.7
</Application.Styles>
```
如果需要进行 AOT 发布,则需要在项目中包含 rd.xml 文件:
```xml
<ItemGroup>
<RdXmlFile Include="rd.xml"/>
</ItemGroup>
```
rd.xml 文件的内容如下:
```xml
<?xml version="1.0" encoding="utf-8"?>
<Directives>
<!--
This file is part of RdXmlLibrary project.
Visit https://github.com/kant2002/rdxmllibrary for latest version.
If you have modifications specific to this Nuget package,
please contribute back.
-->
<Application>
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia" Dynamic="Required All"/>
<!-- If you don't use these, please don't include them.
<Assembly Name="Semi.Avalonia.DataGrid" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia.ColorPicker" Dynamic="Required All"/>
-->
</Application>
</Directives>
```
## 示例
您可以从 Semi Avalonia 的 release 页下载并试用 Semi Avalonia 的展示应用。
@@ -92,13 +68,10 @@ rd.xml 文件的内容如下:
| Semi Design Version | Avalonia Version |
|:--------------------|:-----------------|
| 11.1.0 | >=11.1.0 |
| 11.0.7 | >=11.0.7 |
| 11.0.1 | <=11.0.6 |
## 代办事项
* FocusAdorner
## 致谢
[Semi Design](https://semi.design/)

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.1.0-rc1</AvaloniaVersion>
<AvaloniaVersion>11.1.3</AvaloniaVersion>
</PropertyGroup>
</Project>

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -1,5 +1,6 @@
using Android.App;
using Android.Content.PM;
using Avalonia;
using Avalonia.Android;
namespace Semi.Avalonia.Demo.Android;
@@ -13,4 +14,12 @@ namespace Semi.Avalonia.Demo.Android;
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity<App>
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.With(new AndroidPlatformOptions()
{
RenderingMode = [AndroidRenderingMode.Vulkan, AndroidRenderingMode.Egl, AndroidRenderingMode.Software]
});
}
}

View File

@@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

View File

@@ -0,0 +1,66 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<group
android:name="wrapper"
android:translateX="21"
android:translateY="21">
<group android:name="group">
<path
android:name="path"
android:pathData="M 74.853 85.823 L 75.368 85.823 C 80.735 85.823 85.144 81.803 85.761 76.602 L 85.836 41.76 C 85.225 18.593 66.254 0 42.939 0 C 19.24 0 0.028 19.212 0.028 42.912 C 0.028 66.357 18.831 85.418 42.18 85.823 L 74.853 85.823 Z"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 43.059 14.614 C 29.551 14.614 18.256 24.082 15.445 36.743 C 18.136 37.498 20.109 39.968 20.109 42.899 C 20.109 45.831 18.136 48.301 15.445 49.055 C 18.256 61.716 29.551 71.184 43.059 71.184 C 47.975 71.184 52.599 69.93 56.628 67.723 L 56.628 70.993 L 71.344 70.993 L 71.344 44.072 C 71.357 43.714 71.344 43.26 71.344 42.899 C 71.344 27.278 58.68 14.614 43.059 14.614 Z M 29.51 42.899 C 29.51 35.416 35.576 29.35 43.059 29.35 C 50.541 29.35 56.607 35.416 56.607 42.899 C 56.607 50.382 50.541 56.448 43.059 56.448 C 35.576 56.448 29.51 50.382 29.51 42.899 Z"
android:strokeWidth="1"
android:fillType="evenOdd"/>
<path
android:name="path_2"
android:pathData="M 18.105 42.88 C 18.105 45.38 16.078 47.407 13.579 47.407 C 11.079 47.407 9.052 45.38 9.052 42.88 C 9.052 40.381 11.079 38.354 13.579 38.354 C 16.078 38.354 18.105 40.381 18.105 42.88 Z"
android:strokeWidth="1"/>
</group>
</group>
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:duration="1000"
android:valueFrom="#00ffffff"
android:valueTo="#161c2d"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="path_1">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:duration="1000"
android:valueFrom="#00ffffff"
android:valueTo="#f9f9fb"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="path_2">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:duration="1000"
android:valueFrom="#00ffffff"
android:valueTo="#f9f9fb"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
</animated-vector>

View File

@@ -0,0 +1,71 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<group
android:name="wrapper"
android:translateX="21"
android:translateY="21">
<group android:name="group">
<path
android:name="path"
android:pathData="M 74.853 85.823 L 75.368 85.823 C 80.735 85.823 85.144 81.803 85.761 76.602 L 85.836 41.76 C 85.225 18.593 66.254 0 42.939 0 C 19.24 0 0.028 19.212 0.028 42.912 C 0.028 66.357 18.831 85.418 42.18 85.823 L 74.853 85.823 Z"
android:fillColor="#00ffffff"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 43.059 14.614 C 29.551 14.614 18.256 24.082 15.445 36.743 C 18.136 37.498 20.109 39.968 20.109 42.899 C 20.109 45.831 18.136 48.301 15.445 49.055 C 18.256 61.716 29.551 71.184 43.059 71.184 C 47.975 71.184 52.599 69.93 56.628 67.723 L 56.628 70.993 L 71.344 70.993 L 71.344 44.072 C 71.357 43.714 71.344 43.26 71.344 42.899 C 71.344 27.278 58.68 14.614 43.059 14.614 Z M 29.51 42.899 C 29.51 35.416 35.576 29.35 43.059 29.35 C 50.541 29.35 56.607 35.416 56.607 42.899 C 56.607 50.382 50.541 56.448 43.059 56.448 C 35.576 56.448 29.51 50.382 29.51 42.899 Z"
android:fillColor="#00ffffff"
android:strokeWidth="1"
android:fillType="evenOdd"/>
<path
android:name="path_2"
android:pathData="M 18.105 42.88 C 18.105 45.38 16.078 47.407 13.579 47.407 C 11.079 47.407 9.052 45.38 9.052 42.88 C 9.052 40.381 11.079 38.354 13.579 38.354 C 16.078 38.354 18.105 40.381 18.105 42.88 Z"
android:fillColor="#00ffffff"
android:strokeWidth="1"/>
</group>
</group>
</vector>
</aapt:attr>
<target android:name="path_2">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:startOffset="100"
android:duration="900"
android:valueFrom="#00ffffff"
android:valueTo="#161c2d"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:duration="500"
android:valueFrom="#00ffffff"
android:valueTo="#f9f9fb"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
<target android:name="path_1">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillColor"
android:startOffset="100"
android:duration="900"
android:valueFrom="#00ffffff"
android:valueTo="#161c2d"
android:valueType="colorType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr>
</target>
</animated-vector>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splash_background">#212121</color>
</resources>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme">
</style>
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowSplashScreenBackground">@color/splash_background</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/avalonia_anim</item>
<item name="android:windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/MyTheme.Main</item>
</style>
<style name="MyTheme.Main"
parent ="MyTheme.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>

View File

@@ -1,17 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme">
</style>
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MyTheme.Splash" parent ="MyTheme.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>

View File

@@ -1,25 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<RootNamespace>Semi.Avalonia.Demo.Android</RootNamespace>
</PropertyGroup>
<Import Project="../Directory.Build.props" />
<ItemGroup>
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<AndroidResource Include="Icon.png">
<Link>Resources\drawable\Icon.png</Link>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
<linker>
<assembly fullname="Semi.Avalonia.Demo" preserve="All"/>
</linker>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<!-- Uncomment below to enable Native AOT compilation-->
@@ -11,12 +11,17 @@
-->
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsTrimmable>true</IsTrimmable>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="rd.xml" />
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embeded controls.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="Semi.Avalonia.Demo.Desktop"/>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Directives>
<!--
This file is part of RdXmlLibrary project.
Visit https://github.com/kant2002/rdxmllibrary for latest version.
If you have modifications specific to this Nuget package,
please contribute back.
-->
<Application>
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia.DataGrid" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia.ColorPicker" Dynamic="Required All"/>
<Assembly Name="Semi.Avalonia.Demo" Dynamic="Required All"/>
</Application>
</Directives>

View File

@@ -3,6 +3,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using Avalonia;
using Avalonia.Dialogs;
namespace Semi.Avalonia.Demo.Drm;
@@ -28,7 +29,7 @@ class Program
if (args.Contains("--drm"))
{
SilenceConsole();
return builder.StartLinuxDrm(args: args, card: "/dev/dri/card1", scaling: GetScaling());
return builder.StartLinuxDrm(args, scaling: GetScaling());
}
return builder.StartWithClassicDesktopLifetime(args);
@@ -37,7 +38,9 @@ class Program
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UseManagedSystemDialogs()
.UsePlatformDetect()
.With(new Win32PlatformOptions())
.LogToTrace();
private static void SilenceConsole()

View File

@@ -0,0 +1,162 @@
# DRM Start Steps
[中文](README_CN.md)
(Ubuntu 20.04 live server linux-x64 Virtual Machine Test Success)
(Orange Pi Zero2 Ubuntu20.04-arm64 Test Success)
[Avalonia Official Reference Document](https://docs.avaloniaui.net/docs/next/guides/platforms/rpi/running-on-raspbian-lite-via-drm)
## Setup Running Environment
1. Run the following commands on the Linux side
```bash
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt-get install libgbm1 libgl1-mesa-dri libegl1-mesa libinput10
```
2. Install the test tool (if a colored cube appears, the environment is installed)
```bash
sudo apt-get install kmscube
sudo kmscube
```
3. [Install .NET Runtime](https://learn.microsoft.com/dotnet/core/install/linux?WT.mc_id=dotnet-35129-website)
4. Add the Avalonia.LinuxFramebuffer package in NuGet
```bash
dotnet add package Avalonia.LinuxFramebuffer
```
5. Add StartLinuxDrm code
```csharp
public static int Main(string[] args)
{
var builder = BuildAvaloniaApp();
if (args.Contains("--drm"))
{
SilenceConsole();
// By default, Avalonia will try to detect output card automatically.
// But you can specify one, for example "/dev/dri/card1".
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
}
return builder.StartWithClassicDesktopLifetime(args);
}
private static void SilenceConsole()
{
new Thread(() =>
{
Console.CursorVisible = false;
while (true)
Console.ReadKey(true);
})
{ IsBackground = true }.Start();
}
```
6. Publish the app to Linux
```bash
dotnet publish demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj -c Release -r linux-x64 --sc -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
```
Add the following code to the csproj file for AOT publishing
```xml
<PropertyGroup>
<PublishAot>true</PublishAot>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
</PropertyGroup>
```
```bash
dotnet publish demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj -c Release -r linu-x64
```
7. Run the program
```bash
sudo ./Semi.Avalonia.Demo.Drm --drm
```
## Troubleshooting
1. Error message
> Unhandled exception. Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for avares://Semi.Avalonia/Themes/Light/Light.axaml (baseUri: avares://Semi.Avalonia/Themes/Index.axaml), make sure to specify x:Class and include your XAML file as AvaloniaResource
Solution:
If you use the Semi release file, do not trim it, otherwise an error will occur.
24.8.18 update: This issue has been fixed.
2. Error message
> Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.**
**--->System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
Solution:
Linux CLI installation
```bash
sudo apt-get install -y libfontconfig1
```
[Reference](https://github.com/mono/SkiaSharp/issues/509)
3. Error message
> Permission denied
Solution:
add permission
```bash
sudo chmod +x ./Semi.Avalonia.Demo.Drm
```
4. Error message
> Unhandled exception. System.ComponentModel.Win32Exception (95): drmModeGetResources failed
at Avalonia.LinuxFramebuffer.Output.DrmResources..ctor(Int32 fd, Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 91
at Avalonia.LinuxFramebuffer.Output.DrmCard.GetResources(Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 171
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String path, Boolean connectorsForceProbe, DrmOutputOptions options) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 60
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder builder, String[] args, String card, Double scaling, IInputBackend inputBackend) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[] args)
Solution:
The `program.cs` graphics card path is incorrect, it may not be `dev/dri/card1`, see if there are other graphics cards in the `dev/dri` directory such as `card0`.
24.8.18 update: Avalonia will now automatically detect the graphics card path, so you don't need to specify the graphics card path.
```csharp
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
```
5. Error message
>Unhandled exception. System.ComponentModel.Win32Exception (2): Couldn't open /dev/dri/card1
at Avalonia.LinuxFramebuffer.Output.DrmCard..ctor(String ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 167
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String , Boolean , DrmOutputOptions ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 58
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder, String[], String , Double , IInputBackend ) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[])
Solution:
Unable to open `/dev/dri/card1`, may be the graphics card is mounted to another folder.
24.8.18 update: Avalonia will now automatically detect the graphics card path, so you don't need to specify the graphics card path.
```csharp
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
```

View File

@@ -0,0 +1,162 @@
# DRM启动步骤
[English](README.md)
(Ubuntu 20.04 live server linux-x64 虚拟机测试成功)
(Orange Pi Zero2 Ubuntu20.04-arm64 测试成功)
[Avalonia 官方参考文档](https://docs.avaloniaui.net/docs/next/guides/platforms/rpi/running-on-raspbian-lite-via-drm)
## 搭建运行环境
1. Linux端运行命令
```bash
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt-get install libgbm1 libgl1-mesa-dri libegl1-mesa libinput10
```
2. 安装测试工具(出现一个彩色立方体说明环境安装完成)
```bash
sudo apt-get install kmscube
sudo kmscube
```
3. [安装.net运行时](https://learn.microsoft.com/dotnet/core/install/linux?WT.mc_id=dotnet-35129-website)
4. NuGet里面添加Avalonia.LinuxFramebuffer包
```bash
dotnet add package Avalonia.LinuxFramebuffer
```
5. 添加StartLinuxDrm代码
```csharp
public static int Main(string[] args)
{
var builder = BuildAvaloniaApp();
if (args.Contains("--drm"))
{
SilenceConsole();
// By default, Avalonia will try to detect output card automatically.
// But you can specify one, for example "/dev/dri/card1".
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
}
return builder.StartWithClassicDesktopLifetime(args);
}
private static void SilenceConsole()
{
new Thread(() =>
{
Console.CursorVisible = false;
while (true)
Console.ReadKey(true);
})
{ IsBackground = true }.Start();
}
```
6. 发布程序到Linux
```bash
dotnet publish demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj -c Release -r linux-x64 --sc -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
```
AOT发布需要在csproj文件中添加以下代码
```xml
<PropertyGroup>
<PublishAot>true</PublishAot>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
</PropertyGroup>
```
```bash
dotnet publish demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj -c Release -r linu-x64
```
7. 运行程序
```bash
sudo ./Semi.Avalonia.Demo.Drm --drm
```
## 报错处理
1. 报错内容
> Unhandled exception. Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for avares://Semi.Avalonia/Themes/Light/Light.axaml (baseUri: avares://Semi.Avalonia/Themes/Index.axaml), make sure to specify x:Class and include your XAML file as AvaloniaResource
解决方法:
如果使用Semi发布文件不要裁剪如果裁剪会报错。
24.8.18更新:现在已经修复了这个问题。
2. 报错内容
> Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.**
**--->System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
解决方法:
Linux 命令行安装
```bash
sudo apt-get install -y libfontconfig1
```
[参考网址](https://github.com/mono/SkiaSharp/issues/509)
3. 报错内容
> Permission denied
解决方法:
添加执行权限
```bash
sudo chmod +x ./Semi.Avalonia.Demo.Drm
```
4. 报错内容
> Unhandled exception. System.ComponentModel.Win32Exception (95): drmModeGetResources failed
at Avalonia.LinuxFramebuffer.Output.DrmResources..ctor(Int32 fd, Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 91
at Avalonia.LinuxFramebuffer.Output.DrmCard.GetResources(Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 171
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String path, Boolean connectorsForceProbe, DrmOutputOptions options) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 60
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder builder, String[] args, String card, Double scaling, IInputBackend inputBackend) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[] args)
解决方法:
`program.cs`的显卡路径错误,可能不是`dev/dri/card1`,看在`dev/dri`目录下有无其他的显卡如`card0`
24.8.18更新现在Avalonia会自动检测显卡路径所以不需要指定显卡路径。
```csharp
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
```
5. 报错内容
>Unhandled exception. System.ComponentModel.Win32Exception (2): Couldn't open /dev/dri/card1
at Avalonia.LinuxFramebuffer.Output.DrmCard..ctor(String ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 167
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String , Boolean , DrmOutputOptions ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 58
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder, String[], String , Double , IInputBackend ) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[])
解决办法:
找不到显卡路径`dev/dri/card1`,可能是显卡挂载到别的文件夹下了。
24.8.18更新现在Avalonia会自动检测显卡路径所以不需要指定显卡路径。
```csharp
return builder.StartLinuxDrm(args: args, card: null, scaling: 1.0);
```

View File

@@ -0,0 +1,3 @@
<linker>
<assembly fullname="Semi.Avalonia.Demo" preserve="All"/>
</linker>

View File

@@ -1,22 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<!-- Uncomment below to enable Native AOT compilation-->
<!--
<PublishAot>true</PublishAot>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
-->
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsTrimmable>true</IsTrimmable>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)" />
</ItemGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,77 +0,0 @@
# DRM启动步骤
(Ubuntu18.04Server版本 虚拟机测试OK)
(Orange Pi Zero2 Ubuntu20.04-arm64 测试OK)
Avalonia官方参考文档https://docs.avaloniaui.net/docs/next/guides/platforms/rpi/running-on-raspbian-lite-via-drm
1.Linux端运行命令
```
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt - get install libgbm1 libgl1 - mesa - dri libegl1 - mesa libinput10
```
2.安装测试工具测试(出现一个彩色立方体说明环境安装完成)
```
sudo apt-get install kmscube
sudo kmscube
```
3.安装.net运行时(参考网址https://learn.microsoft.com/zh-cn/dotnet/core/install/linux?WT.mc_id=dotnet-35129-website)
4.新建一个Avalonia项目nuget里面添加Avalonia.LinuxFramebuffer包
5.添加StartLinuxDrm代码(不知道怎么添加看Semi.Avalonia.Demo.Drm项目代码)
6.发布程序到Linux(安装.net怎么运行这些省略)
7.运行 ./Semi.Avalonia.Demo.Drm --drm
## 报错处理:
1. 报错内容
>Unhandled exception. Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for avares://Semi.Avalonia/Themes/Light/Light.axaml (baseUri: avares://Semi.Avalonia/Themes/Index.axaml), make sure to specify x:Class and include your XAML file as AvaloniaResource
解决方法:
>如果使用Semi发布文件不要裁剪如果裁剪会报错
2. 报错内容
>Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.**
**--->System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
解决方法:
>Linux命令行安装一下 apt-get install -y libfontconfig1
参考网址https://github.com/mono/SkiaSharp/issues/509
3. 报错内容
>Permission denied
解决方法:
>sudo chmod +x ./Semi.Avalonia.Demo.Drm
4. 报错内容
>Unhandled exception. System.ComponentModel.Win32Exception (95): drmModeGetResources failed
at Avalonia.LinuxFramebuffer.Output.DrmResources..ctor(Int32 fd, Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 91
at Avalonia.LinuxFramebuffer.Output.DrmCard.GetResources(Boolean connectorsForceProbe) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 171
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String path, Boolean connectorsForceProbe, DrmOutputOptions options) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 60
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder builder, String[] args, String card, Double scaling, IInputBackend inputBackend) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[] args)
解决方法:
>`program.cs`的显卡路径错误,可能不是`dev/dri/card1`,看在`dev/dri`目录下有无其他的显卡如`card0`
5. 报错内容
>Unhandled exception. System.ComponentModel.Win32Exception (2): Couldn't open /dev/dri/card1
at Avalonia.LinuxFramebuffer.Output.DrmCard..ctor(String ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs:line 167
at Avalonia.LinuxFramebuffer.Output.DrmOutput..ctor(String , Boolean , DrmOutputOptions ) in /_/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs:line 58
at LinuxFramebufferPlatformExtensions.StartLinuxDrm(AppBuilder, String[], String , Double , IInputBackend ) in /_/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs:line 166
at Semi.Avalonia.Demo.Drm.Program.Main(String[])
解决办法:
>找不到显卡路径`dev/dri/card1`,可能是显卡挂载到别的文件夹下了,待解决。

View File

@@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Media;
namespace Semi.Avalonia.Demo.Web;
public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Semi.Avalonia.Demo.Web/Assets#Source Han Sans CN";
public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = new[] { new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) } }
});
}

View File

@@ -10,6 +10,7 @@ namespace Semi.Avalonia.Demo.Web;
internal sealed partial class Program
{
private static Task Main(string[] args) => BuildAvaloniaApp()
.WithSourceHanSansCNFont()
.StartBrowserAppAsync("out");
public static AppBuilder BuildAvaloniaApp()

View File

@@ -0,0 +1 @@
[assembly: System.Runtime.Versioning.SupportedOSPlatform("browser")]

View File

@@ -6,8 +6,8 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}"
"applicationUrl": "https://localhost:7169;http://localhost:5235",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
}
}
}

View File

@@ -1,21 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-browser</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>wwwroot\main.js</WasmMainJSPath>
<WasmRuntimeAssetsLocation>./_framework</WasmRuntimeAssetsLocation>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<WasmExtraFilesToDeploy Include="wwwroot\**"/>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
</ItemGroup>
</Project>

View File

@@ -1,11 +1,10 @@
{
"wasmHostProperties": {
"perHostConfig": [
{
"name": "browser",
"html-path": "index.html",
"Host": "browser"
}
]
}
"wasmHostProperties": {
"perHostConfig": [
{
"name": "browser",
"host": "browser"
}
]
}
}

View File

@@ -1,5 +0,0 @@
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M30.4661 34.928C30.5364 34.928 30.6052 34.928 30.6754 34.928C32.8596 34.928 34.654 33.2918 34.9053 31.1752L34.9356 16.9955C34.6872 7.56697 26.9662 0 17.4777 0C7.83263 0 0.0137329 7.8189 0.0137329 17.464C0.0137329 27.0059 7.66618 34.7631 17.1687 34.928H30.4661Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5239 5.948C12.0268 5.948 7.42967 9.80117 6.286 14.954C7.38092 15.2609 8.18385 16.2664 8.18385 17.4593C8.18385 18.6523 7.38092 19.6577 6.286 19.9647C7.42966 25.1175 12.0268 28.9706 17.5239 28.9706C19.525 28.9706 21.4068 28.4601 23.0462 27.562V28.8927H29.0352V17.9365C29.0407 17.7908 29.0352 17.6063 29.0352 17.4593C29.0352 11.1018 23.8814 5.948 17.5239 5.948ZM12.0098 17.4593C12.0098 14.414 14.4786 11.9452 17.5239 11.9452C20.5693 11.9452 23.038 14.414 23.038 17.4593C23.038 20.5047 20.5693 22.9734 17.5239 22.9734C14.4786 22.9734 12.0098 20.5047 12.0098 17.4593Z" fill="#8B44AC"/>
<path d="M7.36841 17.4517C7.36841 18.4691 6.54368 19.2938 5.52631 19.2938C4.50894 19.2938 3.6842 18.4691 3.6842 17.4517C3.6842 16.4343 4.50894 15.6096 5.52631 15.6096C6.54368 15.6096 7.36841 16.4343 7.36841 17.4517Z" fill="#8B44AC"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,74 +1,58 @@
:root {
--sat: env(safe-area-inset-top);
--sar: env(safe-area-inset-right);
--sab: env(safe-area-inset-bottom);
--sal: env(safe-area-inset-left);
}
/* HTML styles for the splash screen */
.highlight {
color: white;
font-size: 2.5rem;
display: block;
}
.purple {
color: #8b44ac;
}
.icon {
opacity: 0.05;
height: 35%;
width: 35%;
/* HTML styles for the splash screen */
.avalonia-splash {
position: absolute;
background-repeat: no-repeat;
right: 0px;
bottom: 0px;
margin-right: 3%;
margin-bottom: 5%;
z-index: 5000;
background-position: right bottom;
height: 100%;
width: 100%;
background: white;
font-family: 'Outfit', sans-serif;
justify-content: center;
align-items: center;
display: flex;
pointer-events: none;
}
#avalonia-splash a {
color: whitesmoke;
/* Light theme styles */
@media (prefers-color-scheme: light) {
.avalonia-splash {
background: white;
}
.avalonia-splash h2 {
color: #1b2a4e;
}
.avalonia-splash a {
color: #0D6EFD;
}
}
@media (prefers-color-scheme: dark) {
.avalonia-splash {
background: #1b2a4e;
}
.avalonia-splash h2 {
color: white;
}
.avalonia-splash a {
color: white;
}
}
.avalonia-splash h2 {
font-weight: 400;
font-size: 1.5rem;
}
.avalonia-splash a {
text-decoration: none;
font-size: 2.5rem;
display: block;
}
.center {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#avalonia-splash {
position: relative;
height: 100%;
width: 100%;
color: whitesmoke;
background: #1b2a4e;
font-family: 'Nunito', sans-serif;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
justify-content: center;
align-items: center;
}
.splash-close {
animation: fadeout 0.25s linear forwards;
}
@keyframes fadeout {
0% {
opacity: 100%;
}
100% {
opacity: 0;
visibility: collapse;
}
.avalonia-splash.splash-close {
transition: opacity 200ms, display 200ms;
display: none;
opacity: 0;
}

View File

@@ -5,26 +5,32 @@
<title>Semi.Avalonia.Demo.Web</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/" />
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./_framework/dotnet.js" />
<link rel="modulepreload" href="./_framework/avalonia.js" />
<link rel="stylesheet" href="./app.css" />
</head>
<body style="margin: 0px; overflow: hidden">
<div id="out">
<div id="avalonia-splash">
<div class="center">
<h2 class="purple">
Powered by
<a class="highlight" href="https://www.avaloniaui.net/" target="_blank">Avalonia UI</a>
</h2>
</div>
<img class="icon" src="Logo.svg" alt="Avalonia Logo" />
</div>
<body style="margin: 0; overflow: hidden">
<div id="out">
<div class="avalonia-splash">
<h2>
Powered by
<a href="https://www.avaloniaui.net/" target="_blank">
<svg width="266" height="52" viewBox="0 0 266 52" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M55.8592 47.3941C54.9035 47.3941 54.1184 47.1723 53.504 46.7285C52.9237 46.2848 52.5483 45.6875 52.3776 44.9365C52.2411 44.1856 52.3947 43.3493 52.8384 42.4277L65.9456 13.7045C66.4917 12.544 67.1403 11.7077 67.8912 11.1957C68.6421 10.6496 69.5125 10.3765 70.5024 10.3765C71.4923 10.3765 72.3627 10.6496 73.1136 11.1957C73.8645 11.7077 74.496 12.544 75.008 13.7045L88.2176 42.4277C88.6613 43.3493 88.8149 44.2027 88.6784 44.9877C88.576 45.7387 88.2347 46.336 87.6544 46.7797C87.0741 47.1893 86.3232 47.3941 85.4016 47.3941C84.2411 47.3941 83.3365 47.1211 82.688 46.5749C82.0736 46.0288 81.5275 45.1755 81.0496 44.0149L78.9279 39.0997H62.0415L59.9552 44.0149C59.4432 45.2096 58.8971 46.08 58.3168 46.6261C57.7707 47.1381 56.9515 47.3941 55.8592 47.3941ZM70.4 19.2853L64.6844 32.9045H76.2627L70.5024 19.2853H70.4Z" fill="currentColor"/>
<path d="M101.869 47.3941C100.879 47.3941 100.009 47.1381 99.258 46.6261C98.5071 46.08 97.9096 45.2779 97.4659 44.2197L89.7348 26.4021C89.3593 25.5147 89.2228 24.6955 89.3252 23.9445C89.4276 23.1595 89.786 22.5451 90.4004 22.1013C91.0489 21.6235 91.9364 21.3845 93.0628 21.3845C93.9844 21.3845 94.7353 21.6064 95.3156 22.0501C95.8959 22.4597 96.4079 23.2619 96.8516 24.4565L102.018 37.95L107.552 24.4053C108.03 23.2448 108.559 22.4597 109.14 22.0501C109.72 21.6064 110.522 21.3845 111.546 21.3845C112.433 21.3845 113.133 21.6235 113.645 22.1013C114.191 22.5451 114.516 23.1424 114.618 23.8933C114.755 24.6443 114.618 25.4635 114.208 26.3509L106.324 44.2197C105.88 45.312 105.283 46.1141 104.532 46.6261C103.815 47.1381 102.927 47.3941 101.869 47.3941Z" fill="currentColor"/>
<path d="M126.569 47.4965C124.726 47.4965 123.07 47.1381 121.602 46.4213C120.135 45.7045 118.991 44.7317 118.172 43.5029C117.353 42.2741 116.943 40.8917 116.943 39.3557C116.943 37.5125 117.421 36.0619 118.377 35.0037C119.333 33.9115 120.886 33.1435 123.036 32.6997C125.186 32.2219 128.037 31.9829 131.586 31.9829H133.43V35.9765H131.638C129.897 35.9765 128.48 36.0789 127.388 36.2837C126.33 36.4544 125.562 36.7616 125.084 37.2053C124.64 37.6491 124.418 38.2635 124.418 39.0485C124.418 40.0043 124.743 40.7893 125.391 41.4037C126.074 42.0181 127.047 42.3253 128.31 42.3253C129.299 42.3253 130.17 42.1035 130.921 41.6597C131.706 41.1819 132.32 40.5504 132.764 39.7653C133.208 38.9461 133.43 38.0245 133.43 37.0005V31.1125C133.43 29.6107 133.088 28.5525 132.406 27.9381C131.723 27.2896 130.562 26.9653 128.924 26.9653C128.002 26.9653 126.995 27.0848 125.903 27.3237C124.845 27.5285 123.667 27.8869 122.37 28.3989C121.619 28.7403 120.954 28.8256 120.374 28.6549C119.793 28.4501 119.35 28.1088 119.042 27.6309C118.735 27.1189 118.582 26.5728 118.582 25.9925C118.582 25.3781 118.752 24.7979 119.094 24.2517C119.435 23.6715 119.998 23.2448 120.783 22.9717C122.387 22.3232 123.889 21.8795 125.289 21.6405C126.722 21.4016 128.037 21.2821 129.231 21.2821C131.859 21.2821 134.01 21.6747 135.682 22.4597C137.389 23.2107 138.669 24.3883 139.522 25.9925C140.376 27.5627 140.802 29.5936 140.802 32.0853V43.4517C140.802 44.7147 140.495 45.6875 139.881 46.3701C139.266 47.0528 138.379 47.3941 137.218 47.3941C136.058 47.3941 135.153 47.0528 134.505 46.3701C133.89 45.6875 133.583 44.7147 133.583 43.4517L133.594 43.15C133.594 43.15 133.293 44.032 132.61 44.8853C131.962 45.7045 131.126 46.3531 130.102 46.8309C129.078 47.2747 127.9 47.4965 126.569 47.4965Z" fill="currentColor"/>
<path d="M155.632 47.4965C152.594 47.4965 150.324 46.6603 148.822 44.9877C147.321 43.2811 146.57 40.7552 146.57 37.4101V14.3189C146.57 13.0219 146.894 12.0491 147.542 11.4005C148.225 10.7179 149.198 10.3765 150.461 10.3765C151.69 10.3765 152.628 10.7179 153.277 11.4005C153.959 12.0491 154.301 13.0219 154.301 14.3189V37.1029C154.301 38.5024 154.591 39.5435 155.171 40.2261C155.786 40.8747 156.588 41.1989 157.578 41.1989C157.851 41.1989 158.107 41.1819 158.346 41.1477C158.585 41.1136 158.841 41.0965 159.114 41.0965C159.66 41.0283 160.035 41.1989 160.24 41.6085C160.479 41.984 160.598 42.752 160.598 43.9125C160.598 44.9365 160.394 45.7216 159.984 46.2677C159.574 46.7797 158.943 47.1211 158.09 47.2917C157.748 47.3259 157.356 47.36 156.912 47.3941C156.468 47.4624 156.042 47.4965 155.632 47.4965Z" fill="currentColor"/>
<path d="M175.453 47.4965C172.756 47.4965 170.401 46.9675 168.387 45.9093C166.407 44.8512 164.871 43.3323 163.779 41.3525C162.687 39.3728 162.141 37.0347 162.141 34.3381C162.141 32.3243 162.448 30.5152 163.062 28.9109C163.677 27.3067 164.564 25.9413 165.725 24.8149C166.919 23.6544 168.336 22.784 169.974 22.2037C171.613 21.5893 173.439 21.2821 175.453 21.2821C178.149 21.2821 180.487 21.8112 182.467 22.8693C184.481 23.9275 186.034 25.4293 187.126 27.3749C188.253 29.3205 188.816 31.6416 188.816 34.3381C188.816 36.3861 188.492 38.2123 187.843 39.8165C187.229 41.4208 186.341 42.8032 185.181 43.9637C184.02 45.1243 182.604 46.0117 180.931 46.6261C179.293 47.2064 177.467 47.4965 175.453 47.4965ZM175.453 41.7109C176.579 41.7109 177.552 41.4379 178.371 40.8917C179.19 40.3456 179.839 39.5435 180.317 38.4853C180.795 37.3931 181.034 36.0107 181.034 34.3381C181.034 31.8464 180.522 30.0203 179.498 28.8597C178.474 27.6651 177.125 27.0677 175.453 27.0677C174.361 27.0677 173.388 27.3237 172.534 27.8357C171.715 28.3477 171.067 29.1499 170.589 30.2421C170.145 31.3003 169.923 32.6656 169.923 34.3381C169.923 36.8299 170.435 38.6901 171.459 39.9189C172.483 41.1136 173.814 41.7109 175.453 41.7109Z" fill="currentColor"/>
<path d="M197.411 47.3941C196.148 47.3941 195.175 47.0528 194.492 46.3701C193.844 45.6875 193.52 44.7147 193.52 43.4517V25.2757C193.52 24.0128 193.844 23.0571 194.492 22.4085C195.175 21.7259 196.114 21.3845 197.308 21.3845C198.537 21.3845 199.476 21.7259 200.124 22.4085C200.773 23.0571 201.112 24.1871 201.112 25.45C201.141 25.3955 202.48 23.552 204.016 22.6645C205.586 21.7429 207.361 21.2821 209.34 21.2821C211.354 21.2821 213.01 21.6747 214.307 22.4597C215.604 23.2107 216.577 24.3712 217.225 25.9413C217.874 27.4773 218.198 29.44 218.198 31.8293V43.4517C218.198 44.7147 217.857 45.6875 217.174 46.3701C216.525 47.0528 215.57 47.3941 214.307 47.3941C213.078 47.3941 212.122 47.0528 211.44 46.3701C210.791 45.6875 210.467 44.7147 210.467 43.4517V32.1877C210.467 30.4469 210.143 29.2011 209.494 28.4501C208.88 27.6651 207.924 27.2725 206.627 27.2725C204.988 27.2725 203.674 27.7845 202.684 28.8085C201.729 29.8325 201.251 31.1979 201.251 32.9045V43.4517C201.251 46.08 199.971 47.3941 197.411 47.3941Z" fill="currentColor"/>
<path d="M227.861 47.3429C226.598 47.3429 225.625 46.9845 224.942 46.2677C224.294 45.5168 223.97 44.4757 223.97 43.1445V25.6341C223.97 24.2688 224.294 23.2277 224.942 22.5109C225.625 21.76 226.598 21.3845 227.861 21.3845C229.09 21.3845 230.028 21.76 230.677 22.5109C231.359 23.2277 231.701 24.2688 231.701 25.6341V43.1445C231.701 44.4757 231.377 45.5168 230.728 46.2677C230.079 46.9845 229.124 47.3429 227.861 47.3429ZM227.861 17.1861C226.427 17.1861 225.318 16.8619 224.533 16.2133C223.782 15.5307 223.406 14.5749 223.406 13.3461C223.406 12.0832 223.782 11.1275 224.533 10.4789C225.318 9.79629 226.427 9.45496 227.861 9.45496C229.294 9.45496 230.387 9.79629 231.138 10.4789C231.889 11.1275 232.264 12.0832 232.264 13.3461C232.264 14.5749 231.889 15.5307 231.138 16.2133C230.387 16.8619 229.294 17.1861 227.861 17.1861Z" fill="currentColor"/>
<path d="M246.169 47.4965C244.326 47.4965 242.67 47.1381 241.202 46.4213C239.735 45.7045 238.591 44.7317 237.772 43.5029C236.953 42.2741 236.543 40.8917 236.543 39.3557C236.543 37.5125 237.021 36.0619 237.977 35.0037C238.933 33.9115 240.486 33.1435 242.636 32.6997C244.786 32.2219 247.637 31.9829 251.186 31.9829H253.03V35.9765H251.238C249.497 35.9765 248.08 36.0789 246.988 36.2837C245.93 36.4544 245.162 36.7616 244.684 37.2053C244.24 37.6491 244.018 38.2635 244.018 39.0485C244.018 40.0043 244.343 40.7893 244.991 41.4037C245.674 42.0181 246.647 42.3253 247.91 42.3253C248.899 42.3253 249.77 42.1035 250.521 41.6597C251.306 41.1819 251.92 40.5504 252.364 39.7653C252.808 38.9461 253.03 38.0245 253.03 37.0005V31.1125C253.03 29.6107 252.688 28.5525 252.006 27.9381C251.323 27.2896 250.162 26.9653 248.524 26.9653C247.602 26.9653 246.595 27.0848 245.503 27.3237C244.445 27.5285 243.267 27.8869 241.97 28.3989C241.219 28.7403 240.554 28.8256 239.974 28.6549C239.393 28.4501 238.95 28.1088 238.642 27.6309C238.335 27.1189 238.182 26.5728 238.182 25.9925C238.182 25.3781 238.352 24.7979 238.694 24.2517C239.035 23.6715 239.598 23.2448 240.383 22.9717C241.987 22.3232 243.489 21.8795 244.889 21.6405C246.322 21.4016 247.637 21.2821 248.831 21.2821C251.459 21.2821 253.61 21.6747 255.282 22.4597C256.989 23.2107 258.269 24.3883 259.122 25.9925C259.976 27.5627 260.402 29.5936 260.402 32.0853V43.4517C260.402 44.7147 260.095 45.6875 259.481 46.3701C258.866 47.0528 257.979 47.3941 256.818 47.3941C255.658 47.3941 254.753 47.0528 254.105 46.3701C253.49 45.6875 253.183 44.7147 253.183 43.4517V43.1789C253.183 43.3144 252.893 44.032 252.21 44.8853C251.562 45.7045 250.726 46.3531 249.702 46.8309C248.678 47.2747 247.5 47.4965 246.169 47.4965Z" fill="currentColor"/>
<path d="M22.3444 20.9916C18.7895 20.9916 15.9077 24.0073 15.9077 27.7274C15.9077 31.4475 18.7895 34.4632 22.3444 34.4632C25.8993 34.4632 28.7811 31.4475 28.7811 27.7274C28.7811 24.0073 25.8993 20.9916 22.3444 20.9916Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M37.6937 49.0667H21.9271C10.8346 48.8653 1.90173 39.3893 1.90173 27.7333C1.90173 15.9513 11.0289 6.40002 22.2878 6.40002C33.3638 6.40002 42.3768 15.6435 42.6667 27.161L42.6314 44.4824C42.338 47.0679 40.2434 49.0667 37.6937 49.0667ZM9.22617 24.667C10.5612 18.3725 15.9275 13.6656 22.3444 13.6656C29.7657 13.6656 35.7818 19.9613 35.7818 27.7274C35.7818 27.7857 35.7825 27.8488 35.7831 27.9136C35.7846 28.0483 35.7861 28.1901 35.7818 28.3103V41.6939H28.7907V40.0685C26.877 41.1655 24.6803 41.7892 22.3444 41.7892C15.9275 41.7892 10.5612 37.0823 9.22617 30.7878C10.5043 30.4129 11.4416 29.1847 11.4416 27.7274C11.4416 26.2701 10.5043 25.0419 9.22617 24.667ZM8.33937 29.9683C9.52696 29.9683 10.4897 28.9609 10.4897 27.7181C10.4897 26.4753 9.52696 25.4678 8.33937 25.4678C7.15178 25.4678 6.18904 26.4753 6.18904 27.7181C6.18904 28.9609 7.15178 29.9683 8.33937 29.9683Z" fill="currentColor"/>
</svg>
</a>
</h2>
</div>
<script type='module' src="./main.js"></script>
</div>
<script type='module' src="./main.js"></script>
</body>
</html>
</html>

View File

@@ -10,4 +10,4 @@ const dotnetRuntime = await dotnet
const config = dotnetRuntime.getConfig();
await dotnetRuntime.runMain(config.mainAssemblyName, [window.location.search]);
await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]);

View File

@@ -4,10 +4,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi">
<Application.Styles>
<!-- You can still reference in old way.
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
-->
<semi:SemiTheme Locale="zh-CN"/>
<!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</Application.Styles>

View File

@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Semi.Avalonia.Demo.Views;
@@ -17,6 +18,9 @@ public partial class App : Application
switch (ApplicationLifetime)
{
case IClassicDesktopStyleApplicationLifetime desktop:
// Line below is needed to remove Avalonia data validation.
// Without this line you will get duplicate validations from both Avalonia and CT
BindingPlugins.DataValidators.RemoveAt(0);
desktop.MainWindow = new MainWindow();
break;
case ISingleViewApplicationLifetime singleView:

View File

@@ -44,11 +44,6 @@
<Button Classes="Danger">Danger</Button>
<Button Classes="Danger" IsEnabled="False">Disabled</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary Small">Small</Button>
<Button Classes="Primary">Default</Button>
<Button Classes="Primary Large">Large</Button>
</StackPanel>
<TextBlock>Solid</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource SolidButton}">Primary</Button>
@@ -64,6 +59,16 @@
Disabled
</Button>
</StackPanel>
<TextBlock>Outline</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource OutlineButton}">Primary</Button>
<Button Classes="Secondary" Theme="{DynamicResource OutlineButton}">Secondary</Button>
<Button Classes="Tertiary" Theme="{DynamicResource OutlineButton}">Tertiary</Button>
<Button Classes="Success" Theme="{DynamicResource OutlineButton}">Success</Button>
<Button Classes="Warning" Theme="{DynamicResource OutlineButton}">Warning</Button>
<Button Classes="Danger" Theme="{DynamicResource OutlineButton}">Danger</Button>
<Button Classes="Danger" Theme="{DynamicResource OutlineButton}" IsEnabled="False">Disabled</Button>
</StackPanel>
<TextBlock>Borderless</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary" Theme="{DynamicResource BorderlessButton}">Primary</Button>
@@ -79,6 +84,19 @@
Disabled
</Button>
</StackPanel>
<TextBlock>Disabled</TextBlock>
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<Button IsEnabled="False">Light</Button>
<Button IsEnabled="False" Theme="{DynamicResource SolidButton}">Solid</Button>
<Button IsEnabled="False" Theme="{DynamicResource OutlineButton}">Outline</Button>
<Button IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Borderless</Button>
</StackPanel>
<TextBlock>Size Classes</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Classes="Primary Small">Small</Button>
<Button Classes="Primary">Default</Button>
<Button Classes="Primary Large">Large</Button>
</StackPanel>
<TextBlock>DropDownButton</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="8">
@@ -96,9 +114,11 @@
<StackPanel Orientation="Horizontal" Spacing="8">
<DropDownButton Content="Default" Classes="Success"/>
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success"/>
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success"/>
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success"/>
<DropDownButton Content="Default" Classes="Success" IsEnabled="False"/>
<DropDownButton Content="Solid" Theme="{DynamicResource SolidDropDownButton}" Classes="Success" IsEnabled="False"/>
<DropDownButton Content="Outline" Theme="{DynamicResource OutlineDropDownButton}" Classes="Success" IsEnabled="False"/>
<DropDownButton Content="Borderless" Theme="{DynamicResource BorderlessDropDownButton}" Classes="Success" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
@@ -119,11 +139,13 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<SplitButton Content="Default" Classes="Success" />
<SplitButton Theme="{DynamicResource SolidSplitButton}" Content="Solid" Classes="Success" />
<SplitButton Theme="{DynamicResource BorderlessSplitButton}" Content="Borderless" Classes="Success" />
<SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" />
<SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" />
<SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" />
<SplitButton Content="Default" Classes="Success" IsEnabled="False" />
<SplitButton Theme="{DynamicResource SolidSplitButton}" Content="Solid" Classes="Success" IsEnabled="False" />
<SplitButton Theme="{DynamicResource BorderlessSplitButton}" Content="Borderless" Classes="Success" IsEnabled="False" />
<SplitButton Content="Solid" Theme="{DynamicResource SolidSplitButton}" Classes="Success" IsEnabled="False" />
<SplitButton Content="Outline" Theme="{DynamicResource OutlineSplitButton}" Classes="Success" IsEnabled="False" />
<SplitButton Content="Borderless" Theme="{DynamicResource BorderlessSplitButton}" Classes="Success" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<SplitButton Classes="Small" Content="Small" />
@@ -141,6 +163,12 @@
<ToggleSplitButton Classes="Danger" Content="Danger" />
<ToggleSplitButton Classes="Danger" Content="Disabled" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSplitButton Content="Default" Classes="Success" />
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" />
<ToggleSplitButton Content="Default" Classes="Success" IsEnabled="False" />
<ToggleSplitButton Content="Checked" Classes="Success" IsChecked="True" IsEnabled="False" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleSplitButton Classes="Small" Content="Small" />
<ToggleSplitButton Content="Default" />

View File

@@ -6,35 +6,56 @@
xmlns:controls="using:Avalonia.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignHeight="1450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel Spacing="20">
<StackPanel
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="20">
<ColorView ColorSpectrumShape="Ring" />
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
<ScrollViewer>
<StackPanel Spacing="20">
<StackPanel
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="20">
<ColorView Name="Test" ColorSpectrumShape="Ring" />
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel>
<StackPanel
VerticalAlignment="Top"
Orientation="Horizontal">
<ColorView
Name="SimpleColorViewTest"
Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True"
HsvColor="hsv(120,11%,10%)" />
<StackPanel>
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
</StackPanel>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker ColorSpectrumShape="Ring">
<ColorPicker.Palette>
<controls:FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box" Theme="{DynamicResource HexColorPicker}">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker Theme="{StaticResource SimpleColorPicker}"
HsvColor="hsv(120,11%,10%)" />
<ColorPicker Theme="{StaticResource HexSimpleColorPicker}"
HsvColor="hsv(120,11%,10%)" />
</StackPanel>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker ColorSpectrumShape="Ring">
<ColorPicker.Palette>
<controls:FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker ColorSpectrumShape="Box" Theme="{DynamicResource HexColorPicker}">
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
</StackPanel>
</UserControl>
</ScrollViewer>
</UserControl>

View File

@@ -14,7 +14,10 @@
<TabControl>
<TabItem Header="DataGrid">
<Grid RowDefinitions="Auto, *">
<ToggleSwitch Grid.Row="0" Content="Disable" Name="DisableToggle"></ToggleSwitch>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Disable" Name="DisableToggle" />
<ToggleSwitch Content="ScrollViewerHide" Name="ScrollViewerHide" />
</StackPanel>
<DataGrid Grid.Row="1"
Margin="8"
CanUserReorderColumns="True"
@@ -22,6 +25,7 @@
CanUserSortColumns="True"
HeadersVisibility="All"
IsReadOnly="True"
ScrollViewer.AllowAutoHide="{Binding #ScrollViewerHide.IsChecked}"
IsEnabled="{Binding #DisableToggle.IsChecked}"
ItemsSource="{Binding GridData1}">
<DataGrid.Columns>

View File

@@ -36,4 +36,4 @@
</Expander>
</Grid>
</StackPanel>
</UserControl>
</UserControl>

View File

@@ -78,8 +78,8 @@
<StackPanel Orientation="Horizontal">
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
<ListBoxItem Classes="Large" IsSelected="True">Small 1</ListBoxItem>
<ListBoxItem Classes="Large">Small 2</ListBoxItem>
<ListBoxItem Classes="Large" IsSelected="True">Large 1</ListBoxItem>
<ListBoxItem Classes="Large">Large 2</ListBoxItem>
</ListBox>
</Border>
<Border
@@ -87,8 +87,8 @@
HorizontalAlignment="Left"
Theme="{StaticResource RadioButtonGroupBorder}">
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}" IsEnabled="False">
<ListBoxItem Classes="Large" IsSelected="True">Small 1</ListBoxItem>
<ListBoxItem Classes="Large">Small 2</ListBoxItem>
<ListBoxItem Classes="Large" IsSelected="True">Large 1</ListBoxItem>
<ListBoxItem Classes="Large">Large 2</ListBoxItem>
</ListBox>
</Border>
</StackPanel>

View File

@@ -7,18 +7,36 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel HorizontalAlignment="Left" Spacing="20">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Theme" Value="{DynamicResource SolidButton}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</StackPanel.Styles>
<Button Click="InfoButton_OnClick" Content="Default" />
<Button Click="InfoButton_OnClick" Content="Information" />
<Button Click="InfoButton_OnClick" Content="Success" Classes="Success" />
<Button Click="InfoButton_OnClick" Content="Warning" Classes="Warning" />
<Button Click="InfoButton_OnClick" Content="Error" Classes="Danger" />
<StackPanel Spacing="20">
<UniformGrid Rows="3" Columns="3" Width="500" HorizontalAlignment="Left">
<UniformGrid.Styles>
<Style Selector="RadioButton">
<Setter Property="Theme" Value="{DynamicResource PureCardRadioButton}" />
</Style>
</UniformGrid.Styles>
<RadioButton Click="PositionButton_OnClick" Content="TopLeft" />
<RadioButton Click="PositionButton_OnClick" Content="TopCenter" />
<RadioButton Click="PositionButton_OnClick" Content="TopRight" IsChecked="True" />
<RadioButton Click="PositionButton_OnClick" Content="BottomLeft" />
<RadioButton Click="PositionButton_OnClick" Content="BottomCenter" />
<RadioButton Click="PositionButton_OnClick" Content="BottomRight" />
</UniformGrid>
<StackPanel Orientation="Horizontal" Spacing="20">
<Button Click="NormalButton_OnClick" Content="Information" />
<Button Click="NormalButton_OnClick" Content="Success" Classes="Success" />
<Button Click="NormalButton_OnClick" Content="Warning" Classes="Warning" />
<Button Click="NormalButton_OnClick" Content="Error" Classes="Danger" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="20">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Theme" Value="{DynamicResource SolidButton}" />
</Style>
</StackPanel.Styles>
<Button Click="LightButton_OnClick" Content="Information" />
<Button Click="LightButton_OnClick" Content="Success" Classes="Success" />
<Button Click="LightButton_OnClick" Content="Warning" Classes="Warning" />
<Button Click="LightButton_OnClick" Content="Error" Classes="Danger" />
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -22,13 +22,34 @@ public partial class NotificationDemo : UserControl
_manager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
}
private void InfoButton_OnClick(object? sender, RoutedEventArgs e)
private void PositionButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is RadioButton b && b.Content is string s)
{
Enum.TryParse<NotificationPosition>(s, out var t);
_manager.Position = t;
}
}
private void NormalButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is Button b && b.Content is string s)
{
_manager?.Show(Enum.TryParse<NotificationType>(s, out NotificationType t)
_manager?.Show(Enum.TryParse<NotificationType>(s, out var t)
? new Notification(t.ToString(), "This is message", t)
: new Notification(s, "This is message"));
}
}
private void LightButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is Button b && b.Content is string s)
{
Enum.TryParse<NotificationType>(s, out var notificationType);
_manager?.Show(
new Notification(notificationType.ToString(), "This is message"),
type: notificationType,
classes: ["Light"]);
}
}
}

View File

@@ -1,8 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
namespace Semi.Avalonia.Demo.Pages;
@@ -13,35 +9,41 @@ public partial class Overview : UserControl
InitializeComponent();
}
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.0.7";
public string MainInstall { get; set; } = "dotnet add package Semi.Avalonia --version 11.1.0";
public string MainStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
</Application.Styles>
""";
public string MainStyle { get; set; } =
"""
<Application.Styles>
<!-- You can still reference in old way. -->
<!-- <StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" /> -->
<semi:SemiTheme Locale="zh-cn" />
</Application.Styles>
""";
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.0.7";
public string ColorPickerInstall { get; set; } = "dotnet add package Semi.Avalonia.ColorPicker --version 11.1.0";
public string ColorPickerStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</Application.Styles>
""";
public string ColorPickerStyle { get; set; } =
"""
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</Application.Styles>
""";
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.0.7";
public string DataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.DataGrid --version 11.1.0";
public string DataGridStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
</Application.Styles>
""";
public string DataGridStyle { get; set; } =
"""
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
</Application.Styles>
""";
public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid --version 11.0.7";
public string TreeDataGridInstall { get; set; } = "dotnet add package Semi.Avalonia.TreeDataGrid --version 11.1.0";
public string TreeDataGridStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
</Application.Styles>
""";
public string TreeDataGridStyle { get; set; } =
"""
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
</Application.Styles>
""";
}

View File

@@ -155,7 +155,7 @@
Value="60" />
<ProgressBar
Width="200"
Classes="Error"
Classes="Danger"
Maximum="100"
Minimum="0"
ShowProgressText="True"

View File

@@ -33,6 +33,21 @@
Disabled
</RepeatButton>
</StackPanel>
<TextBlock>Outline</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary" Theme="{DynamicResource OutlineRepeatButton}">Primary</RepeatButton>
<RepeatButton Classes="Secondary" Theme="{DynamicResource OutlineRepeatButton}">Secondary</RepeatButton>
<RepeatButton Classes="Tertiary" Theme="{DynamicResource OutlineRepeatButton}">Tertiary</RepeatButton>
<RepeatButton Classes="Success" Theme="{DynamicResource OutlineRepeatButton}">Success</RepeatButton>
<RepeatButton Classes="Warning" Theme="{DynamicResource OutlineRepeatButton}">Warning</RepeatButton>
<RepeatButton Classes="Danger" Theme="{DynamicResource OutlineRepeatButton}">Danger</RepeatButton>
<RepeatButton
Classes="Danger"
IsEnabled="False"
Theme="{DynamicResource OutlineRepeatButton}">
Disabled
</RepeatButton>
</StackPanel>
<TextBlock>Borderless</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Primary" Theme="{DynamicResource BorderlessRepeatButton}">Primary</RepeatButton>
@@ -48,10 +63,18 @@
Disabled
</RepeatButton>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock>Disabled</TextBlock>
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<Button IsEnabled="False">Light</Button>
<Button IsEnabled="False" Theme="{DynamicResource SolidButton}">Solid</Button>
<Button IsEnabled="False" Theme="{DynamicResource OutlineButton}">Outline</Button>
<Button IsEnabled="False" Theme="{DynamicResource BorderlessButton}">Borderless</Button>
</StackPanel>
<TextBlock>Size Classes</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="20">
<RepeatButton Classes="Small">Small</RepeatButton>
<RepeatButton>Default</RepeatButton>
<RepeatButton Classes="Large">Large</RepeatButton>
</StackPanel>
</StackPanel>
</UserControl>
</UserControl>

View File

@@ -24,8 +24,9 @@
<TextBox Width="300" PasswordChar="*" />
<TextBox
Width="300"
Classes="revealPasswordButton"
PasswordChar="*" />
Classes="ClearButton RevealPasswordButton"
PasswordChar="*"
Text="123456" />
<TextBox
Width="500"
InnerLeftContent="http://"

View File

@@ -82,7 +82,14 @@
Disabled
</ToggleButton>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Toggle Button Disabled State" />
<StackPanel Background="{DynamicResource SemiColorBackground1}" Orientation="Horizontal" Spacing="20">
<ToggleButton IsThreeState="True" IsEnabled="False">Default</ToggleButton>
<ToggleButton IsThreeState="True" IsEnabled="False" IsChecked="True">Checked</ToggleButton>
<ToggleButton IsThreeState="True" IsEnabled="False" IsChecked="{x:Null}">Indeterminate</ToggleButton>
</StackPanel>
<TextBlock Text="Toggle Button Size" />
<StackPanel Orientation="Horizontal" Spacing="20">
<ToggleButton Classes="Small" IsThreeState="True">Small</ToggleButton>
<ToggleButton IsThreeState="True">Default</ToggleButton>
<ToggleButton Classes="Large" IsThreeState="True">Large</ToggleButton>

View File

@@ -7,7 +7,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel Spacing="20">
<StackPanel Spacing="8" Margin="20">
<ToggleSwitch
Content="Content"
OffContent="OffContent"
@@ -24,11 +24,42 @@
IsEnabled="False"
OffContent="OffContent"
OnContent="OnContent" />
<ToggleSwitch
Theme="{DynamicResource SimpleToggleSwitch}"
Content="Content"
OffContent="OffContent"
OnContent="OnContent" />
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small" IsChecked="True" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small Loading" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Small Loading" IsChecked="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" IsChecked="True" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Loading" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Loading" IsChecked="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Large" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Large" IsChecked="True" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Large Loading" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" Classes="Large Loading" IsChecked="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开"/>
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="" OnContent=""/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" IsChecked="True" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="" OnContent="" IsChecked="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" Classes="Large" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="" OnContent="" Classes="Large" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="关" OnContent="开" Classes="Large" IsChecked="True" />
<ToggleSwitch Theme="{StaticResource SimpleToggleSwitch}" OffContent="" OnContent="" Classes="Large" IsChecked="True" />
</StackPanel>
<ToggleSwitch Theme="{DynamicResource ButtonToggleSwitch}">
<ToggleSwitch.OnContent>
<PathIcon

View File

@@ -1,5 +0,0 @@
<linker>
<!-- Can be removed if CompiledBinding and no reflection are used -->
<assembly fullname="Semi.Avalonia.Demo" preserve="All" />
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" />
</linker>

View File

@@ -7,7 +7,6 @@
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<ItemGroup>
@@ -15,7 +14,7 @@
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -47,8 +47,8 @@ public class PaletteDemoViewModel: ObservableObject
public PaletteDemoViewModel()
{
_lightResourceDictionary = AvaloniaXamlLoader.Load(new Uri("avares://Semi.Avalonia/Themes/Light/Palette.axaml")) as ResourceDictionary;
_darkResourceDictionary = AvaloniaXamlLoader.Load(new Uri("avares://Semi.Avalonia/Themes/Dark/Palette.axaml")) as ResourceDictionary;
_lightResourceDictionary = new Light.Palette();
_darkResourceDictionary = new Dark.Palette();
WeakReferenceMessenger.Default.Register<PaletteDemoViewModel, ColorItemViewModel>(this, OnClickColorItem);
}
@@ -251,7 +251,7 @@ public static class ColorTokens
{
new ("SemiColorPrimary", "Primary"),
new ("SemiColorPrimaryPointerover", "Primary Pointerover"),
new ("SemiColorPrimaryPressed", "Primary Pressed"),
new ("SemiColorPrimaryActive", "Primary Active"),
new ("SemiColorPrimaryDisabled", "Primary Disabled"),
new ("SemiColorPrimaryLight", "Primary Light"),
new ("SemiColorPrimaryLightPointerover", "Primary Light Pointerover"),
@@ -262,7 +262,7 @@ public static class ColorTokens
{
new ("SemiColorSecondary", "Secondary"),
new ("SemiColorSecondaryPointerover", "Secondary Pointerover"),
new ("SemiColorSecondaryPressed", "Secondary Pressed"),
new ("SemiColorSecondaryActive", "Secondary Active"),
new ("SemiColorSecondaryDisabled", "Secondary Disabled"),
new ("SemiColorSecondaryLight", "Secondary Light"),
new ("SemiColorSecondaryLightPointerover", "Secondary Light Pointerover"),
@@ -273,7 +273,7 @@ public static class ColorTokens
{
new ("SemiColorTertiary", "Tertiary"),
new ("SemiColorTertiaryPointerover", "Tertiary Pointerover"),
new ("SemiColorTertiaryPressed", "Tertiary Pressed"),
new ("SemiColorTertiaryActive", "Tertiary Active"),
new ("SemiColorTertiaryLight", "Tertiary Light"),
new ("SemiColorTertiaryLightPointerover", "Tertiary Light Pointerover"),
new ("SemiColorTertiaryLightActive", "Tertiary Light Active"),
@@ -283,7 +283,7 @@ public static class ColorTokens
{
new ("SemiColorInformation", "Information"),
new ("SemiColorInformationPointerover", "Information Pointerover"),
new ("SemiColorInformationPressed", "Information Pressed"),
new ("SemiColorInformationActive", "Information Active"),
new ("SemiColorInformationDisabled", "Information Disabled"),
new ("SemiColorInformationLight", "Information Light"),
new ("SemiColorInformationLightPointerover", "Information Light Pointerover"),
@@ -294,7 +294,7 @@ public static class ColorTokens
{
new ("SemiColorSuccess", "Success"),
new ("SemiColorSuccessPointerover", "Success Pointerover"),
new ("SemiColorSuccessPressed", "Success Pressed"),
new ("SemiColorSuccessActive", "Success Active"),
new ("SemiColorSuccessDisabled", "Success Disabled"),
new ("SemiColorSuccessLight", "Success Light"),
new ("SemiColorSuccessLightPointerover", "Success Light Pointerover"),
@@ -305,7 +305,7 @@ public static class ColorTokens
{
new ("SemiColorWarning", "Warning"),
new ("SemiColorWarningPointerover", "Warning Pointerover"),
new ("SemiColorWarningPressed", "Warning Pressed"),
new ("SemiColorWarningActive", "Warning Active"),
new ("SemiColorWarningLight", "Warning Light"),
new ("SemiColorWarningLightPointerover", "Warning Light Pointerover"),
new ("SemiColorWarningLightActive", "Warning Light Active"),
@@ -315,7 +315,7 @@ public static class ColorTokens
{
new ("SemiColorDanger", "Danger"),
new ("SemiColorDangerPointerover", "Danger Pointerover"),
new ("SemiColorDangerPressed", "Danger Pressed"),
new ("SemiColorDangerActive", "Danger Active"),
new ("SemiColorDangerLight", "Danger Light"),
new ("SemiColorDangerLightPointerover", "Danger Light Pointerover"),
new ("SemiColorDangerLightActive", "Danger Light Active"),

View File

@@ -1,13 +1,13 @@
<UserControl
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Semi.Avalonia.Demo.Views.MainView"
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:pages="using:Semi.Avalonia.Demo.Pages"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -21,52 +21,68 @@
Margin="8"
Padding="12,4"
Theme="{DynamicResource CardBorder}">
<Grid ColumnDefinitions="*, Auto" VerticalAlignment="Center">
<Grid VerticalAlignment="Center" ColumnDefinitions="*, Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
Classes="H6"
Text="Semi Avalonia"
Theme="{DynamicResource TitleTextBlock}"
VerticalAlignment="Center" />
Theme="{DynamicResource TitleTextBlock}" />
<TextBlock
Margin="8,0"
Text="/"
VerticalAlignment="Center" />
VerticalAlignment="Center"
Text="/" />
<TextBlock
Margin="8,0"
VerticalAlignment="Center"
Classes="Secondary"
Margin="8,0"
Text="{Binding #tab.SelectedItem.Header}"
VerticalAlignment="Center" />
Text="{Binding #tab.SelectedItem.Header}" />
</StackPanel>
<ToggleSwitch
Grid.Column="1"
IsCheckedChanged="ToggleButton_OnIsCheckedChanged"
Padding="4"
Theme="{DynamicResource ButtonToggleSwitch}">
<ToggleSwitch.OnContent>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button Theme="{DynamicResource BorderlessButton}" Click="OpenDocumentation">
<PathIcon
Data="M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17 15C17.476 15 17.9408 14.9525 18.3901 14.862C17.296 17.3011 14.8464 19 12 19C8.13401 19 5 15.866 5 12C5 8.60996 7.40983 5.78277 10.6099 5.13803C10.218 6.01173 10 6.98041 10 8C10 11.866 13.134 15 17 15Z"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}"
Width="16"
Height="16"
Width="16" />
</ToggleSwitch.OnContent>
<ToggleSwitch.OffContent>
Data="M12 21.5C10.65 20.65 8.2 20 6.5 20C4.85 20 3.15 20.3 1.75 21.05C1.65 21.1 1.6 21.1 1.5 21.1C1.25 21.1 1 20.85 1 20.6V6C1.6 5.55 2.25 5.25 3 5C4.11 4.65 5.33 4.5 6.5 4.5C8.45 4.5 10.55 4.9 12 6C13.45 4.9 15.55 4.5 17.5 4.5C18.67 4.5 19.89 4.65 21 5C21.75 5.25 22.4 5.55 23 6V20.6C23 20.85 22.75 21.1 22.5 21.1C22.4 21.1 22.35 21.1 22.25 21.05C20.85 20.3 19.15 20 17.5 20C15.8 20 13.35 20.65 12 21.5M12 8V19.5C13.35 18.65 15.8 18 17.5 18C18.7 18 19.9 18.15 21 18.5V7C19.9 6.65 18.7 6.5 17.5 6.5C15.8 6.5 13.35 7.15 12 8M13 11.5C14.11 10.82 15.6 10.5 17.5 10.5C18.41 10.5 19.26 10.59 20 10.78V9.23C19.13 9.08 18.29 9 17.5 9C15.73 9 14.23 9.28 13 9.84V11.5M17.5 11.67C15.79 11.67 14.29 11.93 13 12.46V14.15C14.11 13.5 15.6 13.16 17.5 13.16C18.54 13.16 19.38 13.24 20 13.4V11.9C19.13 11.74 18.29 11.67 17.5 11.67M20 14.57C19.13 14.41 18.29 14.33 17.5 14.33C15.67 14.33 14.17 14.6 13 15.13V16.82C14.11 16.16 15.6 15.83 17.5 15.83C18.54 15.83 19.38 15.91 20 16.07V14.57Z"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Button>
<Button Theme="{DynamicResource BorderlessButton}" Click="OpenRepository">
<PathIcon
Data="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}"
Width="16"
Height="16"
Width="16" />
</ToggleSwitch.OffContent>
</ToggleSwitch>
Data="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Button>
<ToggleSwitch
Grid.Column="1"
Padding="4"
IsCheckedChanged="ToggleButton_OnIsCheckedChanged"
Theme="{DynamicResource ButtonToggleSwitch}">
<ToggleSwitch.OnContent>
<PathIcon
Width="16"
Height="16"
Data="M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17 15C17.476 15 17.9408 14.9525 18.3901 14.862C17.296 17.3011 14.8464 19 12 19C8.13401 19 5 15.866 5 12C5 8.60996 7.40983 5.78277 10.6099 5.13803C10.218 6.01173 10 6.98041 10 8C10 11.866 13.134 15 17 15Z"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</ToggleSwitch.OnContent>
<ToggleSwitch.OffContent>
<PathIcon
Width="16"
Height="16"
Data="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</ToggleSwitch.OffContent>
</ToggleSwitch>
</StackPanel>
</Grid>
</Border>
<TabControl
Grid.Row="1"
HorizontalAlignment="Stretch"
Margin="8"
Name="tab"
Grid.Row="1"
Margin="8"
Padding="20,0,0,0"
HorizontalAlignment="Stretch"
TabStripPlacement="Left"
Theme="{DynamicResource NavigationTab}">
<TabItem Header="Overview">

View File

@@ -1,3 +1,4 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
@@ -21,4 +22,20 @@ public partial class MainView : UserControl
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
}
}
private async void OpenRepository(object sender, RoutedEventArgs e)
{
var top = TopLevel.GetTopLevel(this);
if (top is null) return;
var launcher = top.Launcher;
await launcher.LaunchUriAsync(new Uri("https://github.com/irihitech/Semi.Avalonia"));
}
private async void OpenDocumentation(object sender, RoutedEventArgs e)
{
var top = TopLevel.GetTopLevel(this);
if (top is null) return;
var launcher = top.Launcher;
await launcher.LaunchUriAsync(new Uri("https://docs.irihi.tech/semi"));
}
}

View File

@@ -1,5 +1,5 @@
{
"sdk": {
"version": "7.0"
"version": "8.0"
}
}

View File

@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.0",
"version": "8.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}

View File

@@ -1,16 +1,16 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>11.1.0-rc1</Version>
<Version>11.1.0.2</Version>
<Authors>IRIHI Technology Co., Ltd.</Authors>
<Description>Avalonia Theme inspired by Semi Design.</Description>
<RepositoryUrl>https://github.com/irihitech/Semi.Avalonia</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>irihi.png</PackageIcon>
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
<AvaloniaVersion>11.1.0-rc1</AvaloniaVersion>
<AvaloniaVersion>11.1.0</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -234,7 +234,7 @@
RowDefinitions="Auto,24,1*,1*,1*,1*,12"
Tag="{TemplateBinding ColorModel}">
<Grid.Styles>
<Style Selector="NumericUpDown /template/ TextBox">
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
<Template>
<TextBlock Width="12" Text="{Binding $parent[NumericUpDown].Tag}" />
@@ -514,4 +514,199 @@
</Setter>
</ControlTheme>
<ControlTheme
x:Key="SimpleColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker">
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorPicker}">
<DropDownButton
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Padding="0,0,10,0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
ClipToBounds="True"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
UseLayoutRounding="False">
<DropDownButton.Styles>
<Style Selector="FlyoutPresenter.nopadding">
<Setter Property="Padding" Value="0" />
</Style>
</DropDownButton.Styles>
<DropDownButton.Flyout>
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
<!--
The following is copy-pasted from the ColorView's control template.
It MUST always be kept in sync with the ColorView (which is master).
Note the only changes are resources specific to the ColorPicker.
-->
<Grid Width="280">
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Spectrum Tab -->
<Border
Grid.Row="0"
CornerRadius="8 8 0 0"
ClipToBounds="True">
<primitives:ColorSpectrum
x:Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
MinHue="{TemplateBinding MinHue}"
MinSaturation="{TemplateBinding MinSaturation}"
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
</Border>
<primitives:ColorSlider
x:Name="ColorSpectrumThirdComponentSlider"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Horizontal" />
<primitives:ColorSlider
x:Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
TickFrequency="1"
Orientation="Horizontal">
</primitives:ColorSlider>
<StackPanel
Grid.Row="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="0 8 0 0">
<Border
Background="{TemplateBinding Color, Converter={StaticResource ToBrushConverter}}"
Width="20"
Height="20"
CornerRadius="4" />
<Panel
x:Name="PART_TextBoxPanel"
Width="106"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
x:Name="PART_HexTextBox"
Classes="Small"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
<TextBox
x:Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
x:Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
x:Name="AlphaComponentNumericUpDown"
Width="70"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
Minimum="{Binding #ColorSpectrumAlphaSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
<ComboBox
x:Name="ColorModelComboBox"
Width="80"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>
</Grid>
</Flyout>
</DropDownButton.Flyout>
</DropDownButton>
</ControlTemplate>
</Setter>
<Style Selector="^[IsAlphaVisible=False] /template/ Panel#PART_TextBoxPanel">
<Setter Property="Width" Value="176" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker">
<Setter Property="Width" Value="200" />
<Setter Property="Content">
<Template>
<Grid ColumnDefinitions="Auto, *">
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border
Grid.Column="0"
Width="{Binding $self.Bounds.Height}"
Margin="1,1,0,1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding HsvColor,
Converter={StaticResource ToBrushConverter}}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
Grid.Column="1"
Margin="8,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontWeight="Regular"
Foreground="{DynamicResource TextBlockDefaultForeground}"
Text="{Binding $parent[ColorPicker].Color}" />
</Grid>
</Template>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -6,13 +6,17 @@
xmlns:globalization="using:System.Globalization"
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
xmlns:primitives="using:Avalonia.Controls.Primitives"
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters"
x:CompileBindings="True">
<!-- Add Resources Here -->
<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" />
<VisualBrush
@@ -322,7 +326,7 @@
RowDefinitions="Auto,24,1*,1*,1*,1*,12"
UseLayoutRounding="False">
<Grid.Styles>
<Style Selector="NumericUpDown /template/ TextBox">
<Style Selector="NumericUpDown">
<Setter Property="InnerLeftContent">
<Template>
<TextBlock Width="12" Text="{Binding $parent[NumericUpDown].Tag}" />
@@ -376,7 +380,7 @@
AutomationProperties.Name="Hexadecimal Color"
InnerLeftContent="#"
IsVisible="{TemplateBinding IsHexInputVisible}"
MaxLength="9" />
MaxLength="8" />
</Grid>
<!-- Color component editing controls -->
<!-- Component 1 RGB:Red HSV:Hue -->
@@ -560,4 +564,142 @@
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
<Setter Property="Width" Value="280" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type ColorView}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="280" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Spectrum Tab -->
<Border
Grid.Row="0"
CornerRadius="8 8 0 0"
ClipToBounds="True">
<primitives:ColorSpectrum
x:Name="ColorSpectrum"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Components="{TemplateBinding ColorSpectrumComponents}"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
MaxHue="{TemplateBinding MaxHue}"
MaxSaturation="{TemplateBinding MaxSaturation}"
MaxValue="{TemplateBinding MaxValue}"
MinHue="{TemplateBinding MinHue}"
MinSaturation="{TemplateBinding MinSaturation}"
MinValue="{TemplateBinding MinValue}"
Shape="{TemplateBinding ColorSpectrumShape}" />
</Border>
<primitives:ColorSlider
x:Name="ColorSpectrumThirdComponentSlider"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
AutomationProperties.Name="Third Component"
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
ColorModel="Hsva"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
Orientation="Horizontal" />
<primitives:ColorSlider
x:Name="ColorSpectrumAlphaSlider"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
AutomationProperties.Name="Alpha Component"
ColorComponent="Alpha"
ColorModel="Hsva"
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
IsVisible="{TemplateBinding IsAlphaVisible}"
IsRoundingEnabled="True"
IsSnapToTickEnabled="True"
TickFrequency="1"
Orientation="Horizontal">
</primitives:ColorSlider>
<StackPanel
Grid.Row="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="0 8 0 0">
<Border
Background="{TemplateBinding Color, Converter={StaticResource ToBrushConverter}}"
Width="20"
Height="20"
CornerRadius="4" />
<Panel
x:Name="PART_TextBoxPanel"
Width="106"
Margin="4 0 0 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<TextBox
x:Name="PART_HexTextBox"
Classes="Small"
InnerLeftContent="#"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
MaxLength="8" />
<TextBox
x:Name="PART_RgbaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
<TextBox
x:Name="PART_HsvaTextBox"
Classes="Small"
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
</Panel>
<NumericUpDown
x:Name="AlphaComponentNumericUpDown"
Width="70"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AllowSpin="True"
Classes="Small"
IsEnabled="{TemplateBinding IsAlphaEnabled}"
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
Minimum="{Binding #ColorSpectrumAlphaSlider.Minimum}"
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
ShowButtonSpinner="False"
InnerRightContent="%"
IsVisible="{TemplateBinding IsAlphaVisible}"
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
<ComboBox
x:Name="ColorModelComboBox"
Width="80"
VerticalAlignment="Center"
Classes="Small"
SelectedValue="Hex">
Hex<ColorModel>Rgba</ColorModel>
<ColorModel>Hsva</ColorModel>
</ComboBox>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^[IsAlphaVisible=False] /template/ Panel#PART_TextBoxPanel">
<Setter Property="Width" Value="176" />
</Style>
</ControlTheme>
<Design.PreviewWith>
<ColorView
Theme="{StaticResource SimpleColorView}"
IsAlphaVisible="True"
IsAlphaEnabled="True"
ColorModel="Hsva"
HsvColor="hsv(120,7%,90%)" />
</Design.PreviewWith>
</ResourceDictionary>

View File

@@ -0,0 +1,34 @@
using System;
using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace Semi.Avalonia.ColorPicker.Converters;
public class ColorToTextConverter : IValueConverter
{
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;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');
if (parts.Length != 4 || parts.Any(string.IsNullOrWhiteSpace)) return BindingOperations.DoNothing;
if (byte.TryParse(parts[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var r) &&
byte.TryParse(parts[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var g) &&
byte.TryParse(parts[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out var b) &&
byte.TryParse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture, out var a))
{
return new Color(a, r, g, b);
}
return BindingOperations.DoNothing;
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace Semi.Avalonia.ColorPicker.Converters;
public class HsvColorToTextConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is HsvColor hsvColor
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
: AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string str) return BindingOperations.DoNothing;
var parts = str.Split(',');
if (parts.Length != 4 || parts.Any(string.IsNullOrWhiteSpace)) return BindingOperations.DoNothing;
if (double.TryParse(parts[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var h) &&
double.TryParse(parts[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var s) &&
double.TryParse(parts[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var v) &&
double.TryParse(parts[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var a))
{
return new HsvColor(a / 100, h, s / 100, v / 100);
}
return BindingOperations.DoNothing;
}
}

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

@@ -2,8 +2,8 @@
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<MergeResourceInclude x:Key="Default" Source="avares://Semi.Avalonia.ColorPicker/Light.axaml" />
<MergeResourceInclude x:Key="Dark" Source="avares://Semi.Avalonia.ColorPicker/Dark.axaml" />
<ResourceInclude x:Key="Default" Source="avares://Semi.Avalonia.ColorPicker/Light.axaml" />
<ResourceInclude x:Key="Dark" Source="avares://Semi.Avalonia.ColorPicker/Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml" />

View File

@@ -4,7 +4,11 @@
<PropertyGroup>
<Title>Semi.Avalonia.ColorPicker</Title>
<PackageReleaseNotes>Update to Avalonia 11.1-rc1</PackageReleaseNotes>
<PackageReleaseNotes>Update to Avalonia 11.1.0.2</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>

View File

@@ -29,4 +29,5 @@
<colorPicker:SemiColorDarkPalette x:Key="SemiColorPalette" />
<PlacementMode x:Key="ColorPickerFlyoutPlacement">AnchorAndGravity</PlacementMode>
<PlacementMode x:Key="SimpleColorPickerFlyoutPlacement">BottomEdgeAlignedLeft</PlacementMode>
</ResourceDictionary>

View File

@@ -292,7 +292,7 @@
Name="BackgroundBorder"
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Margin="2"
Margin="{DynamicResource DataGridRowMargin}"
Background="{DynamicResource DataGridRowBackground}"
CornerRadius="3" />
<Rectangle
@@ -471,6 +471,7 @@
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="GridLinesVisibility" Value="None" />
<Setter Property="ScrollViewer.AllowAutoHide" Value="True" />
<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource DataGridLineBrush}" />
<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource DataGridLineBrush}" />
<Setter Property="DropLocationIndicatorTemplate">
@@ -570,5 +571,15 @@
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
<Style Selector="^[(ScrollViewer.AllowAutoHide)=False]">
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
<Setter Property="Grid.RowSpan" Value="1" />
<Setter Property="Grid.ColumnSpan" Value="2" />
</Style>
<Style Selector="^ /template/ DataGridColumnHeadersPresenter#PART_ColumnHeadersPresenter">
<Setter Property="Grid.ColumnSpan" Value="1" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -2,8 +2,8 @@
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<MergeResourceInclude x:Key="Default" Source="avares://Semi.Avalonia.DataGrid/Light.axaml" />
<MergeResourceInclude x:Key="Dark" Source="avares://Semi.Avalonia.DataGrid/Dark.axaml" />
<ResourceInclude x:Key="Default" Source="avares://Semi.Avalonia.DataGrid/Light.axaml" />
<ResourceInclude x:Key="Dark" Source="avares://Semi.Avalonia.DataGrid/Dark.axaml" />
</ResourceDictionary.ThemeDictionaries>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Semi.Avalonia.DataGrid/DataGrid.axaml" />

View File

@@ -4,7 +4,11 @@
<PropertyGroup>
<Title>Semi.Avalonia.DataGrid</Title>
<PackageReleaseNotes>Update to Avalonia 11.1-rc1</PackageReleaseNotes>
<PackageReleaseNotes>Update to Avalonia 11.1.0.2</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>

View File

@@ -12,6 +12,7 @@
<StreamGeometry x:Key="DataGridColumnHeaderDescendingGlyph">M17.549 15.659L12.753 21.139C12.6591 21.2464 12.5434 21.3325 12.4135 21.3915C12.2836 21.4505 12.1427 21.481 12 21.481C11.8574 21.481 11.7164 21.4505 11.5865 21.3915C11.4566 21.3325 11.3409 21.2464 11.247 21.139L6.45101 15.659C5.88501 15.011 6.34501 14 7.20401 14H16.796C17.656 14 18.115 15.012 17.549 15.659Z</StreamGeometry>
<Thickness x:Key="DataGridRowHeaderMargin">8 0</Thickness>
<Thickness x:Key="DataGridRowMargin">2</Thickness>
<StreamGeometry x:Key="DataGridRowGroupHeaderExpandIconGlyph">M7.43934 19.7957C6.85355 19.2099 6.85355 18.2601 7.43934 17.6744L13.0962 12.0175L7.43934 6.36065C6.85355 5.77486 6.85355 4.82511 7.43934 4.23933C8.02513 3.65354 8.97487 3.65354 9.56066 4.23933L16.2782 10.9568C16.864 11.5426 16.864 12.4924 16.2782 13.0782L9.56066 19.7957C8.97487 20.3815 8.02513 20.3815 7.43934 19.7957Z</StreamGeometry>

View File

@@ -14,6 +14,10 @@
<AvaloniaVersion>11.0.0</AvaloniaVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="$(AvaloniaVersion)"/>
<None Include="irihi.png" Pack="true" PackagePath=""/>

View File

@@ -5,4 +5,5 @@
</StreamGeometry>
<StreamGeometry x:Key="TreeDataGridSortIconAscendingPath">M6.45096 8.34102L11.247 2.86102C11.3408 2.75361 11.4566 2.66753 11.5865 2.60854C11.7163 2.54956 11.8573 2.51904 12 2.51904C12.1426 2.51904 12.2836 2.54956 12.4135 2.60854C12.5433 2.66753 12.6591 2.75361 12.753 2.86102L17.549 8.34102C18.115 8.98802 17.655 10 16.796 10H7.20396C6.34396 10 5.88496 8.98802 6.45096 8.34102Z</StreamGeometry>
<StreamGeometry x:Key="TreeDataGridItemCollapsedChevronPathData">M9.65618 3.44015L18.6322 11.2454C19.0906 11.644 19.0906 12.356 18.6322 12.7546L9.65618 20.5598C9.00895 21.1226 8 20.6629 8 19.8052V4.19475C8 3.33705 9.00895 2.87734 9.65618 3.44015Z</StreamGeometry>
<Thickness x:Key="TreeDataGridRowMargin">2</Thickness>
</ResourceDictionary>

View File

@@ -149,7 +149,7 @@
<Panel>
<Border
Name="RowBorder"
Margin="2"
Margin="{DynamicResource TreeDataGridRowMargin}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
@@ -183,8 +183,7 @@
<CheckBox
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="Center"
IsChecked="{TemplateBinding Value,
Mode=TwoWay}"
IsChecked="{TemplateBinding Value, Mode=TwoWay}"
IsEnabled="{Binding !IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
IsThreeState="{TemplateBinding IsThreeState}"
Theme="{DynamicResource SimpleCheckBox}" />
@@ -239,8 +238,7 @@
DockPanel.Dock="Left">
<ToggleButton
Focusable="False"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"
IsVisible="{TemplateBinding ShowExpander}"
Theme="{StaticResource TreeDataGridExpandCollapseChevron}" />
</Border>
@@ -287,8 +285,7 @@
<TextBox
Name="PART_Edit"
Classes="Small"
Text="{TemplateBinding Value,
Mode=TwoWay}" />
Text="{TemplateBinding Value, Mode=TwoWay}" />
</Border>
</ControlTemplate>
</Setter>

View File

@@ -5,11 +5,8 @@
<ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer">
<Setter Property="DefaultFocusAdorner">
<FocusAdornerTemplate>
<Rectangle
Margin="{DynamicResource AdornerLayerMargin}"
Stroke="{DynamicResource AdornerLayerBackground}"
StrokeDashArray="1,2"
StrokeThickness="{DynamicResource AdornerLayerThickness}" />
<Border BorderThickness="{DynamicResource AdornerLayerBorderThickness}"
BorderBrush="{DynamicResource AdornerLayerStroke}" />
</FocusAdornerTemplate>
</Setter>
</ControlTheme>

View File

@@ -2,9 +2,9 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<!-- Button Theme Key: Solid Light Border Borderless; Default is Light -->
<!-- Button Default Classes: Primary Secondary, Tertiary, Warning, Danger; Default is Primary -->
<!-- State default pointerover pressed disabled -->
<!-- Button Theme Key: Light, Solid, Outline, Borderless; Default is Light -->
<!-- Button Default Classes: Primary, Secondary, Tertiary, Success, Warning, Danger; Default is Primary -->
<!-- State: default, pointerover, pressed, disabled -->
<!-- Button Light -->
<ControlTheme x:Key="{x:Type Button}" TargetType="Button">
@@ -48,7 +48,7 @@
<Style Selector="^:pressed">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" />
<Setter Property="Background" Value="{TemplateBinding Background}" />
@@ -85,7 +85,6 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
@@ -104,9 +103,9 @@
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Button.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Button.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="Button.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
@@ -211,7 +210,39 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="OutlineButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^.Success /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
</Style>
<Style Selector="^.Warning /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
</Style>
<Style Selector="^.Danger /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
@@ -254,4 +285,4 @@
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPressedForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -41,7 +41,6 @@
<Setter Property="ButtonSpinner.BorderBrush" Value="{DynamicResource ButtonSpinnerRepeatButtonBorderBrush}" />
<Setter Property="ButtonSpinner.BorderThickness" Value="0" />
<Setter Property="ButtonSpinner.MinWidth" Value="300" />
<!-- Add Resource -->
<Setter Property="ButtonSpinner.Template">
<ControlTemplate TargetType="ButtonSpinner">
<Grid ColumnDefinitions="Auto, *, Auto">
@@ -49,8 +48,7 @@
Grid.Column="1"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
UseLayoutRounding="False">
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"

View File

@@ -31,6 +31,7 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type CalendarItem}" TargetType="CalendarItem">
<Setter Property="CalendarItem.MinWidth" Value="{DynamicResource CalendarMinWidth}" />
<Setter Property="CalendarItem.MinHeight" Value="{DynamicResource CalendarMinHeight}" />
<Setter Property="CalendarItem.DayTitleTemplate">
<Template>
@@ -53,7 +54,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid
MinWidth="{DynamicResource CalendarMinWidth}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"

View File

@@ -34,11 +34,10 @@
<Grid
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ColumnDefinitions="*, Auto, Auto">
ColumnDefinitions="*, Auto">
<TextBox
Name="PART_TextBox"
Grid.Column="0"
Grid.ColumnSpan="2"
MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -85,7 +84,7 @@
Theme="{DynamicResource InnerIconButton}" />
<Button
Name="PART_Button"
Grid.Column="2"
Grid.Column="1"
Padding="0,0,8,0"
Content="{DynamicResource CalendarDatePickerIconGlyph}"
Focusable="False"
@@ -122,10 +121,13 @@
</ControlTemplate>
</Setter>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^:pointerover /template/ Button#ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNotNull}}"></Setter>
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ Button#PART_Button">
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNull}}" />
</Style>
</Style>

View File

@@ -26,6 +26,7 @@
<Grid x:Name="RootGrid" ColumnDefinitions="Auto,*">
<Grid
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
Margin="0,0,0,0"
VerticalAlignment="Center">
<Border
@@ -123,8 +124,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -166,8 +167,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -275,8 +276,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -315,8 +316,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -457,8 +458,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>
@@ -512,8 +513,8 @@
<Setter Property="Background" Value="{DynamicResource CheckBoxCheckedDisabledBackground}" />
</Style>
<Style Selector="^ /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
<Style Selector="^ /template/ PathIcon#CheckGlyph">
<Setter Property="Foreground" Value="{DynamicResource CheckBoxGlyphDisabledFill}" />
</Style>
</Style>
</Style>

View File

@@ -46,11 +46,11 @@
<Setter Property="Template">
<ControlTemplate TargetType="ComboBox">
<DataValidationErrors>
<Grid ColumnDefinitions="*, Auto, 32">
<Grid ColumnDefinitions="*, Auto">
<Border
x:Name="Background"
Grid.Column="0"
Grid.ColumnSpan="3"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
BorderBrush="{TemplateBinding BorderBrush}"
@@ -80,13 +80,15 @@
<Button
Name="ClearButton"
Grid.Column="1"
Margin="0,0,8,0"
Command="{Binding $parent[ComboBox].Clear}"
Content="{DynamicResource IconButtonClearData}"
Focusable="False"
IsVisible="False"
Theme="{DynamicResource InnerIconButton}" />
<Border
x:Name="DropDownOverlay"
Grid.Column="2"
Grid.Column="1"
Width="30"
Margin="0,1,1,1"
HorizontalAlignment="Right"
@@ -95,12 +97,10 @@
<PathIcon
x:Name="DropDownGlyph"
Grid.Column="2"
Grid.Column="1"
Width="12"
Height="12"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,12,0"
Data="{DynamicResource ComboBoxIcon}"
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
IsHitTestVisible="False"
@@ -148,6 +148,9 @@
<Style Selector="^:pointerover /template/ Button#ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ PathIcon#DropDownGlyph">
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"/>
</Style>
</Style>
<Style Selector="^.Large">

View File

@@ -110,7 +110,6 @@
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
</Style>
<Style Selector="^.Large">
@@ -232,7 +231,41 @@
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="OutlineDropDownButton"
BasedOn="{StaticResource {x:Type DropDownButton}}"
TargetType="DropDownButton">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border#RootBorder">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^.Success /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
</Style>
<Style Selector="^.Warning /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
</Style>
<Style Selector="^.Danger /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
@@ -244,12 +277,12 @@
BasedOn="{StaticResource {x:Type DropDownButton}}"
TargetType="DropDownButton">
<Style Selector="^ /template/ Border#RootBorder">
<Setter Property="DropDownButton.Background" Value="Transparent" />
<Setter Property="DropDownButton.BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:disabled /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -23,7 +23,7 @@
<Setter Property="Expander.BorderBrush" Value="{DynamicResource ExpanderSeparatorBorderBrush}" />
<Setter Property="Expander.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Expander.HorizontalAlignment" Value="Stretch" />
<Setter Property="Expander.HorizontalContentAlignment" Value="Left" />
<Setter Property="Expander.HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Expander.VerticalContentAlignment" Value="Stretch" />
<Setter Property="Expander.Template">
<ControlTemplate TargetType="Expander">

View File

@@ -301,6 +301,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
RecognizesAccessKey="True" />
<Popup
Name="PART_Popup"

View File

@@ -3,15 +3,26 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<Design.PreviewWith>
<NotificationCard>
<TextBlock Text="Hello World" />
</NotificationCard>
<ThemeVariantScope RequestedThemeVariant="Dark">
<StackPanel>
<NotificationCard>
Hello, Semi.Avalonia!
</NotificationCard>
<NotificationCard NotificationType="Success">
<Notification Title="Welcome" Message="Hello, Semi.Avalonia!" />
</NotificationCard>
<NotificationCard NotificationType="Warning">
<Notification Title="" Message="Hello, Semi.Avalonia!" />
</NotificationCard>
<NotificationCard NotificationType="Error">
<Notification Message="Hello, Semi.Avalonia!" />
</NotificationCard>
</StackPanel>
</ThemeVariantScope>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type NotificationCard}" TargetType="NotificationCard">
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="MinWidth" Value="{DynamicResource NotificationCardWidth}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource NotificationCardForeground}" />
<Setter Property="MinWidth" Value="{DynamicResource NotificationCardMinWidth}" />
<Setter Property="RenderTransformOrigin" Value="50%,75%" />
<Setter Property="BorderThickness" Value="{DynamicResource NotificationCardBorderThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource NotificationCardBorderBrush}" />
@@ -21,47 +32,50 @@
<ControlTemplate TargetType="NotificationCard">
<LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
<Border
Margin="8"
BoxShadow="{DynamicResource NotificationCardBoxShadows}"
Margin="{DynamicResource NotificationCardMargin}"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<Border
Background="{TemplateBinding Background}"
x:Name="PART_RootBorder"
Padding="{DynamicResource NotificationCardPadding}"
BoxShadow="{DynamicResource NotificationCardBoxShadow}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ClipToBounds="True"
CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel>
<PathIcon
Name="NotificationIcon"
Width="16"
Height="16"
Margin="16,16,12,0"
Width="{DynamicResource NotificationCardIconWidth}"
Height="{DynamicResource NotificationCardIconHeight}"
Margin="{DynamicResource NotificationCardIconMargin}"
VerticalAlignment="Top"
IsVisible="False"
Data="{DynamicResource NotificationCardInformationIconPathData}"/>
Data="{DynamicResource NotificationCardInformationIconPathData}" />
<ContentControl
Name="PART_Content"
MinHeight="64"
Content="{TemplateBinding Content}">
<ContentControl.DataTemplates>
<DataTemplate DataType="INotification">
<StackPanel Margin="0,8,8,8" Spacing="8">
<TextBlock
FontSize="16"
FontWeight="600"
<StackPanel Spacing="{DynamicResource NotificationCardTitleSpacing}">
<SelectableTextBlock
Foreground="{DynamicResource NotificationCardTitleForeground}"
FontSize="{DynamicResource NotificationCardTitleFontSize}"
FontWeight="{DynamicResource NotificationCardTitleFontWeight}"
IsVisible="{Binding Title, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{Binding Title}" />
<TextBlock
MaxHeight="80"
Margin="0,0,8,0"
FontSize="14"
FontWeight="400"
<SelectableTextBlock
Foreground="{DynamicResource NotificationCardMessageForeground}"
FontSize="{DynamicResource NotificationCardMessageFontSize}"
FontWeight="{DynamicResource NotificationCardMessageFontWeight}"
Text="{Binding Message}"
TextWrapping="Wrap" />
</StackPanel>
</DataTemplate>
<DataTemplate DataType="x:String">
<TextBlock
Margin="12"
<SelectableTextBlock
Foreground="{DynamicResource NotificationCardMessageForeground}"
FontSize="{DynamicResource NotificationCardMessageFontSize}"
FontWeight="{DynamicResource NotificationCardMessageFontWeight}"
Text="{Binding}"
TextWrapping="Wrap" />
</DataTemplate>
@@ -153,5 +167,25 @@
<Setter Property="Foreground" Value="{DynamicResource NotificationCardErrorIconForeground}" />
<Setter Property="Data" Value="{DynamicResource NotificationCardErrorIconPathData}" />
</Style>
<Style Selector="^.Light">
<Setter Property="Background" Value="{DynamicResource SemiColorBackground0}" />
<Style Selector="^:information /template/ Border#PART_RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorInformation}" />
<Setter Property="Background" Value="{DynamicResource SemiColorInformationLight}" />
</Style>
<Style Selector="^:success /template/ Border#PART_RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorSuccess}" />
<Setter Property="Background" Value="{DynamicResource SemiColorSuccessLight}" />
</Style>
<Style Selector="^:warning /template/ Border#PART_RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorWarning}" />
<Setter Property="Background" Value="{DynamicResource SemiColorWarningLight}" />
</Style>
<Style Selector="^:error /template/ Border#PART_RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SemiColorDanger}" />
<Setter Property="Background" Value="{DynamicResource SemiColorDangerLight}" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -185,6 +185,10 @@
<Style Selector="^.Warning">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarWarningForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarDangerForeground}" />
</Style>
<!-- Error style is obsolete, use Danger instead -->
<Style Selector="^.Error">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarErrorForeground}" />
</Style>
@@ -411,6 +415,10 @@
<Style Selector="^.Warning">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarWarningForeground}" />
</Style>
<Style Selector="^.Danger">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarDangerForeground}" />
</Style>
<!-- Error style is obsolete, use Danger instead -->
<Style Selector="^.Error">
<Setter Property="Foreground" Value="{DynamicResource ProgressBarErrorForeground}" />
</Style>

View File

@@ -39,7 +39,11 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid ColumnDefinitions="Auto,*">
<Grid Margin="{DynamicResource RadioButtonIconMargin}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid
Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
Margin="{DynamicResource RadioButtonIconMargin}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Ellipse
Name="OuterEllipse"
Width="{DynamicResource RadioButtonIconRadius}"

View File

@@ -4,17 +4,17 @@
x:CompileBindings="True">
<ControlTheme x:Key="{x:Type RepeatButton}" TargetType="RepeatButton">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultBackground}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
@@ -22,7 +22,7 @@
<Setter Property="Template">
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter
Name="PART_ContentPresenter"
x:Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -43,7 +43,7 @@
<Style Selector="^:pressed">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" />
<Setter Property="Background" Value="{TemplateBinding Background}" />
@@ -80,17 +80,16 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<Style Selector="^.Large">
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonLargeHeight}" />
<Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
</Style>
<Style Selector="^.Small">
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
<Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
</Style>
</ControlTheme>
@@ -103,6 +102,16 @@
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
</Style>
<Style Selector="^.Primary">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
@@ -196,7 +205,39 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="OutlineRepeatButton"
BasedOn="{StaticResource {x:Type RepeatButton}}"
TargetType="RepeatButton">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
</Style>
<Style Selector="^.Success /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
</Style>
<Style Selector="^.Warning /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
</Style>
<Style Selector="^.Danger /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
@@ -206,8 +247,8 @@
BasedOn="{StaticResource {x:Type RepeatButton}}"
TargetType="RepeatButton">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="RepeatButton.Background" Value="Transparent" />
<Setter Property="RepeatButton.BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="Transparent" />

View File

@@ -17,6 +17,7 @@
<Setter Property="SelectableTextBlock.FontSize" Value="{DynamicResource TextBlockFontSize}" />
<Setter Property="SelectableTextBlock.Cursor" Value="Ibeam" />
<Setter Property="SelectableTextBlock.SelectionBrush" Value="{DynamicResource TextBlockSelectionBackground}" />
<Setter Property="SelectableTextBlock.SelectionForegroundBrush" Value="{DynamicResource TextBlockSelectionForeground}" />
<Style Selector="^.Secondary">
<Setter Property="Foreground" Value="{DynamicResource TextBlockSecondaryForeground}" />
</Style>

View File

@@ -116,7 +116,7 @@
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ Button">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
@@ -130,7 +130,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Secondary /template/ Button">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultSecondaryForeground}" />
@@ -158,7 +158,7 @@
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
</Style>
</Style>
<Style Selector="^.Secondary /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
<Style Selector="^:pointerover">
@@ -218,9 +218,13 @@
<Setter Property="MinHeight" Value="{DynamicResource ButtonSmallHeight}" />
</Style>
<Style Selector="^:disabled /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<!-- only for ToggleSplitButton -->
<Style Selector="^:checked:disabled /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
</Style>
</ControlTheme>
<ControlTheme
@@ -230,7 +234,7 @@
<Style Selector="^ /template/ Button">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
</Style>
@@ -301,7 +305,37 @@
</Style>
<Style Selector="^:disabled /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="OutlineSplitButton"
BasedOn="{StaticResource {x:Type SplitButton}}"
TargetType="SplitButton">
<Style Selector="^ /template/ Button">
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource ButtonOutlinePressedBackground}" />
</Style>
</Style>
<Style Selector="^.Success /template/ Button">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineSuccessBorderBrush}" />
</Style>
<Style Selector="^.Warning /template/ Button">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineWarningBorderBrush}" />
</Style>
<Style Selector="^.Danger /template/ Button">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineDangerBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ Button">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonOutlineBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonOutlineBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
@@ -320,4 +354,4 @@
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -26,7 +26,7 @@
<ControlTheme x:Key="{x:Type TextBox}" TargetType="TextBox">
<ControlTheme.Resources>
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
<Setter Property="ToggleButton.Foreground" Value="{DynamicResource TextBoxButtonDefaultForeground}" />
<Setter Property="ToggleButton.Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
<Setter Property="ToggleButton.Cursor" Value="Hand" />
<Setter Property="ToggleButton.Template">
<ControlTemplate TargetType="ToggleButton">
@@ -45,6 +45,12 @@
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPointeroverForeground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPressedForeground}" />
</Style>
</ControlTheme>
</ControlTheme.Resources>
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxForeground}" />

View File

@@ -73,6 +73,7 @@
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
</Style>
<Style Selector="^.Primary">
@@ -159,6 +160,7 @@
</Style>
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonCheckedDisabledBackground}" />
</Style>
</Style>
@@ -248,12 +250,12 @@
</Style>
<Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonIndeterminateDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
</Style>
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDisabledForeground}" />
<Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultDisabledBackground}" />
</Style>
<Style Selector="^.Large">

View File

@@ -15,6 +15,13 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Border BorderThickness="{DynamicResource AdornerLayerBorderThickness}"
BorderBrush="{DynamicResource AdornerLayerStroke}"
CornerRadius="100"/>
</FocusAdornerTemplate>
</Setter>
<Setter Property="KnobTransitions">
<Transitions>
<DoubleTransition
@@ -28,81 +35,99 @@
<Grid
Background="{TemplateBinding Background}"
Cursor="Hand"
RowDefinitions="Auto,*">
RowDefinitions="Auto,*"
ColumnDefinitions="Auto, *">
<ContentPresenter
x:Name="PART_ContentPresenter"
Grid.Row="0"
Grid.Row="0" Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{DynamicResource ToggleSwitchHeaderMargin}"
VerticalAlignment="Top"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
RecognizesAccessKey="True" />
<Grid
Grid.Row="1"
Background="Transparent"
ColumnDefinitions="Auto, *">
<Grid
Grid.Column="0"
Grid.ColumnSpan="2"
TemplatedControl.IsTemplateFocusTarget="True" />
<Border
Name="SwitchBackgroundBorder"
Grid.Column="0"
Width="40"
Height="20"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
<Border
x:Name="SwitchBackgroundBorder"
Grid.Row="1" Grid.Column="0"
TemplatedControl.IsTemplateFocusTarget="True"
Width="{DynamicResource ToggleSwitchDefaultWidth}"
Height="{DynamicResource ToggleSwitchDefaultHeight}"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
<Canvas
x:Name="PART_SwitchKnob"
Grid.Column="0"
Width="20"
Height="20"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
HorizontalAlignment="Left">
<Grid
x:Name="PART_MovingKnobs"
Width="20"
Height="20">
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Margin="{DynamicResource ToggleSwitchIndicatorDefaultMargin}">
<Border
x:Name="SwitchKnobIndicator"
Width="14"
Height="14"
Background="White"
BorderBrush="{DynamicResource ToggleSwitchIndicatorBorderBrush}"
BorderThickness="0.5"
BoxShadow="0 0 1 1 #222E3238"
CornerRadius="100" />
<Arc
x:Name="SwitchKnobLoadingIndicator"
IsVisible="False"
StrokeThickness="2"
StartAngle="0"
SweepAngle="140"
StrokeJoin="Round"
StrokeLineCap="Round">
<Arc.Stroke>
<ConicGradientBrush>
<GradientStops>
<GradientStop Offset="0.1" Color="Transparent" />
<GradientStop Offset="0.7" Color="White" />
</GradientStops>
</ConicGradientBrush>
</Arc.Stroke>
<Arc.Styles>
<Style Selector="Arc[IsVisible=True]">
<Style.Animations>
<Animation IterationCount="Infinite" Duration="0:0:0.6">
<KeyFrame Cue="0%">
<Setter Property="RotateTransform.Angle" Value="0.0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="RotateTransform.Angle" Value="360.0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Arc.Styles>
</Arc>
</Grid>
</Canvas>
</Border>
<ContentPresenter
x:Name="PART_OnContentPresenter"
Grid.Column="1"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}"
IsVisible="True" />
<ContentPresenter
x:Name="PART_OffContentPresenter"
Grid.Column="1"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}"
IsVisible="False" />
</Grid>
<ContentPresenter
x:Name="PART_OnContentPresenter"
Grid.Row="1" Grid.Column="1"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" />
<ContentPresenter
x:Name="PART_OffContentPresenter"
Grid.Row="1" Grid.Column="1"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Grid>
</ControlTemplate>
</Setter>
@@ -154,6 +179,58 @@
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerCheckedDisabledBackground}" />
</Style>
</Style>
<Style Selector="^.Loading">
<Style Selector="^ /template/ Border#SwitchKnobIndicator">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:unchecked /template/ Border#SwitchBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerUnCheckedPointeroverBackground}" />
</Style>
<Style Selector="^:checked /template/ Border#SwitchBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource ToggleSwitchContainerCheckedPointeroverBackground}" />
</Style>
</Style>
<Style Selector="^.Small">
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchSmallWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchSmallHeight}" />
</Style>
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
</Style>
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorSmallMargin}"/>
</Style>
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorSmallStrokeThickness}" />
</Style>
</Style>
<Style Selector="^.Large">
<Style Selector="^ /template/ Border#SwitchBackgroundBorder">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchLargeWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchLargeHeight}" />
</Style>
<Style Selector="^ /template/ Canvas#PART_SwitchKnob">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
</Style>
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorLargeMargin}"/>
</Style>
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorLargeStrokeThickness}" />
</Style>
</Style>
</ControlTheme>
<ControlTheme
@@ -163,6 +240,12 @@
<Setter Property="Padding" Value="8" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Border BorderThickness="{DynamicResource AdornerLayerBorderThickness}"
BorderBrush="{DynamicResource AdornerLayerStroke}" />
</FocusAdornerTemplate>
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch">
<Border
@@ -171,9 +254,9 @@
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
Cursor="Hand">
<Grid ColumnDefinitions="Auto">
<Grid x:Name="PART_SwitchKnob" />
<Grid x:Name="PART_MovingKnobs" />
<Panel>
<Panel x:Name="PART_SwitchKnob" />
<Panel x:Name="PART_MovingKnobs" />
<ContentPresenter
x:Name="PART_OnContentPresenter"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
@@ -184,7 +267,7 @@
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Grid>
</Panel>
</Border>
</ControlTemplate>
</Setter>
@@ -200,56 +283,110 @@
x:Key="SimpleToggleSwitch"
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
TargetType="ToggleSwitch">
<Setter Property="OnContent" Value="{x:Null}" />
<Setter Property="OffContent" Value="{x:Null}" />
<Setter Property="FontSize" Value="{DynamicResource SimpleToggleSwitchFontSize}" />
<Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch">
<Grid
<Border
x:Name="SwitchBackgroundBorder"
Background="{TemplateBinding Background}"
Cursor="Hand"
RowDefinitions="*">
Width="{DynamicResource ToggleSwitchDefaultWidth}"
Height="{DynamicResource ToggleSwitchDefaultHeight}"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
<Grid
Grid.Row="0"
Background="Transparent"
ColumnDefinitions="Auto, *">
<Grid
Grid.Column="0"
Grid.ColumnSpan="2"
TemplatedControl.IsTemplateFocusTarget="True" />
<Border
Name="SwitchBackgroundBorder"
Grid.Column="0"
Width="40"
Height="20"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
</Border>
ColumnDefinitions="*,*">
<Canvas
x:Name="PART_SwitchKnob"
Grid.Column="0"
Width="20"
Height="20"
Grid.ColumnSpan="2"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
HorizontalAlignment="Left">
<Grid
x:Name="PART_MovingKnobs"
Width="20"
Height="20">
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Margin="{DynamicResource ToggleSwitchIndicatorDefaultMargin}">
<Border
x:Name="SwitchKnobIndicator"
Width="14"
Height="14"
Background="White"
BorderBrush="{DynamicResource ToggleSwitchIndicatorBorderBrush}"
BorderThickness="0.5"
BoxShadow="0 0 1 1 #222E3238"
CornerRadius="100" />
<Arc
x:Name="SwitchKnobLoadingIndicator"
IsVisible="False"
StrokeThickness="2"
StartAngle="0"
SweepAngle="140"
StrokeJoin="Round"
StrokeLineCap="Round">
<Arc.Stroke>
<ConicGradientBrush>
<GradientStops>
<GradientStop Offset="0.1" Color="Transparent" />
<GradientStop Offset="0.7" Color="White" />
</GradientStops>
</ConicGradientBrush>
</Arc.Stroke>
<Arc.Styles>
<Style Selector="Arc[IsVisible=True]">
<Style.Animations>
<Animation IterationCount="Infinite" Duration="0:0:0.6">
<KeyFrame Cue="0%">
<Setter Property="RotateTransform.Angle" Value="0.0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="RotateTransform.Angle" Value="360.0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Arc.Styles>
</Arc>
</Grid>
</Canvas>
<ContentPresenter
x:Name="PART_OnContentPresenter"
Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" />
<ContentPresenter
x:Name="PART_OffContentPresenter"
Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:unchecked">
<Setter Property="Foreground" Value="{DynamicResource SimpleToggleSwitchContainerUnCheckedForeground}" />
</Style>
<Style Selector="^:checked">
<Setter Property="Foreground" Value="{DynamicResource SimpleToggleSwitchContainerCheckedForeground}" />
</Style>
<Style Selector="^.Small">
<Style Selector="^ /template/ ContentPresenter#PART_OnContentPresenter">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_OffContentPresenter">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
x:Class="Semi.Avalonia.Locale.en_us"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">day</x:String>

View File

@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Locale;
public class en_us: ResourceDictionary
{
}

View File

@@ -0,0 +1,24 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
x:Class="Semi.Avalonia.Locale.ja_jp"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String>
<x:String x:Key="STRING_DATEPICKER_MONTH_TEXT">月</x:String>
<x:String x:Key="STRING_DATEPICKER_YEAR_TEXT">年</x:String>
<!-- TimePicker -->
<x:String x:Key="STRING_TIMEPICKER_HOUR_TEXT">時</x:String>
<x:String x:Key="STRING_TIMEPICKER_MINUTE_TEXT">分</x:String>
<!-- TextBox/SelectableTextBox flyout -->
<x:String x:Key="STRING_MENU_CUT">切り取り</x:String>
<x:String x:Key="STRING_MENU_COPY">コピー</x:String>
<x:String x:Key="STRING_MENU_PASTE">貼り付け</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">ファイル名</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">隠しファイルを表示</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_OK">確認</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_CANCEL">キャンセル</x:String>
<x:String x:Key="STRING_CHOOSER_NAME_COLUMN">名前</x:String>
<x:String x:Key="STRING_CHOOSER_DATEMODIFIED_COLUMN">更新日時</x:String>
<x:String x:Key="STRING_CHOOSER_TYPE_COLUMN">種類</x:String>
<x:String x:Key="STRING_CHOOSER_SIZE_COLUMN">サイズ</x:String>
</ResourceDictionary>

View File

@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Locale;
public class ja_jp: ResourceDictionary
{
}

View File

@@ -0,0 +1,24 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
x:Class="Semi.Avalonia.Locale.ru_ru"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">день</x:String>
<x:String x:Key="STRING_DATEPICKER_MONTH_TEXT">месяц</x:String>
<x:String x:Key="STRING_DATEPICKER_YEAR_TEXT">год</x:String>
<!-- TimePicker -->
<x:String x:Key="STRING_TIMEPICKER_HOUR_TEXT">часы</x:String>
<x:String x:Key="STRING_TIMEPICKER_MINUTE_TEXT">минуты</x:String>
<!-- TextBox/SelectableTextBox flyout -->
<x:String x:Key="STRING_MENU_CUT">Вырезать</x:String>
<x:String x:Key="STRING_MENU_COPY">Копировать</x:String>
<x:String x:Key="STRING_MENU_PASTE">Вставить</x:String>
<!-- ManagedFileChooser -->
<x:String x:Key="STRING_CHOOSER_FILE_NAME">Имя файла</x:String>
<x:String x:Key="STRING_CHOOSER_SHOW_HIDDEN_FILES">Показать скрытые файлы</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_OK">OK</x:String>
<x:String x:Key="STRING_CHOOSER_DIALOG_CANCEL">Cancel</x:String>
<x:String x:Key="STRING_CHOOSER_NAME_COLUMN">Имя</x:String>
<x:String x:Key="STRING_CHOOSER_DATEMODIFIED_COLUMN">Дата изменения</x:String>
<x:String x:Key="STRING_CHOOSER_TYPE_COLUMN">Тип</x:String>
<x:String x:Key="STRING_CHOOSER_SIZE_COLUMN">Размер</x:String>
</ResourceDictionary>

View File

@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Locale;
public class ru_ru : ResourceDictionary
{
}

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
x:Class="Semi.Avalonia.Locale.zh_cn"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- DatePicker -->
<x:String x:Key="STRING_DATEPICKER_DAY_TEXT">日</x:String>

View File

@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace Semi.Avalonia.Locale;
public class zh_cn: ResourceDictionary
{
}

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