Compare commits

..

53 Commits

Author SHA1 Message Date
rabbitism
8a7b8715c9 feat: bump version. 2024-09-01 09:52:15 +08:00
rabbitism
7da5934684 feat: sync upstream. 2024-09-01 09:51:12 +08:00
rabbitism
52afd97a94 feat: upgrade to 11.2.0-beta1 2024-09-01 09:51:12 +08:00
Zhang Dian
f2bb8d848a misc: bump version. 2024-08-30 17:27:34 +08:00
Darth-Lexx
c3257d97fa Rul Locale update 2024-08-30 16:59:54 +08:00
Dong Bin
b9a1b2c81e Merge pull request #425 from irihitech/issue/194
remove DropDown List padding
2024-08-30 16:46:06 +08:00
rabbitism
52a25d8441 feat: set corners for scrollviewer. 2024-08-30 16:06:26 +08:00
Zhang Dian
4bd73119ac fix: remove MenuFlyoutPadding. 2024-08-30 16:00:58 +08:00
Dong Bin
210b74aef6 Merge pull request #424 from irihitech/NonErrorTextBox
Unify NonErrorTextBox styles with default TextBox styles
2024-08-29 18:20:49 +08:00
Zhang Dian
d27acf269e feat: update NonErrorTextBox. 2024-08-29 16:14:49 +08:00
Dong Bin
40d7fbcf7f Merge pull request #423 from irihitech/issue/422
Add ManagedFileChooserOverwritePrompt Styles
2024-08-27 12:20:17 +08:00
Zhang Dian
e4c21aefc6 fix: add ManagedFileChooserOverwritePrompt styles. 2024-08-26 20:16:46 +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
MakesYT
259f8cb5bd Merge branch 'irihitech:main' into expander 2024-08-02 15:41:19 +08:00
MakesYT
7c63d45d5e 修改 expander默认HorizontalContentAlignment为Stretch 2024-07-28 17:46:36 +08:00
73 changed files with 1705 additions and 469 deletions

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.1.0</AvaloniaVersion>
<AvaloniaVersion>11.2.0-beta1</AvaloniaVersion>
</PropertyGroup>
</Project>

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

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

@@ -13,8 +13,8 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</StackPanel.Styles>
<Button Name="openFileDialog">Open File</Button>
<Button Name="selectFolderDialog">Select Folder</Button>
<Button Name="saveFileDialog">Save File</Button>
<Button Name="OpenFileButton" Content="Open File" />
<Button Name="SelectFolderButton" Content="Select Folder" />
<Button Name="SaveFileButton" Content="Save File" />
</StackPanel>
</UserControl>

View File

@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Dialogs;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Platform.Storage;
namespace Semi.Avalonia.Demo.Pages;
@@ -14,14 +10,14 @@ public partial class ManagedFileChooserDemo : UserControl
public ManagedFileChooserDemo()
{
InitializeComponent();
openFileDialog.Click += OpenFileDialog;
selectFolderDialog.Click += SelectFolderDialog;
saveFileDialog.Click += SaveFileDialog;
OpenFileButton.Click += OpenFileDialog;
SelectFolderButton.Click += SelectFolderDialog;
SaveFileButton.Click += SaveFileDialog;
}
private async void OpenFileDialog(object sender, RoutedEventArgs args)
private async void OpenFileDialog(object? sender, RoutedEventArgs args)
{
IStorageProvider? sp = GetStorageProvider();
var sp = GetStorageProvider();
if (sp is null) return;
var result = await sp.OpenFilePickerAsync(new FilePickerOpenOptions()
{
@@ -30,9 +26,10 @@ public partial class ManagedFileChooserDemo : UserControl
AllowMultiple = true,
});
}
private async void SelectFolderDialog(object sender, RoutedEventArgs args)
private async void SelectFolderDialog(object? sender, RoutedEventArgs args)
{
IStorageProvider? sp = GetStorageProvider();
var sp = GetStorageProvider();
if (sp is null) return;
var result = await sp.OpenFolderPickerAsync(new FolderPickerOpenOptions()
{
@@ -40,16 +37,17 @@ public partial class ManagedFileChooserDemo : UserControl
AllowMultiple = true,
});
}
private async void SaveFileDialog(object sender, RoutedEventArgs args)
private async void SaveFileDialog(object? sender, RoutedEventArgs args)
{
IStorageProvider? sp = GetStorageProvider();
var sp = GetStorageProvider();
if (sp is null) return;
var result = await sp.SaveFilePickerAsync(new FilePickerSaveOptions()
{
Title = "Open File",
Title = "Save File",
});
}
private IStorageProvider? GetStorageProvider()
{
var topLevel = TopLevel.GetTopLevel(this);
@@ -58,10 +56,10 @@ public partial class ManagedFileChooserDemo : UserControl
List<FilePickerFileType>? GetFileTypes()
{
return new List<FilePickerFileType>
{
return
[
FilePickerFileTypes.All,
FilePickerFileTypes.TextPlain
};
];
}
}

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

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

@@ -9,6 +9,7 @@
mc:Ignorable="d">
<StackPanel Spacing="20">
<TimePicker />
<TimePicker UseSeconds="True" />
<TimePicker Classes="ClearButton" />
<TimePicker MinuteIncrement="15" />
<TimePicker ClockIdentifier="24HourClock" />

View File

@@ -26,15 +26,38 @@
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" 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" 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}">

View File

@@ -3,14 +3,14 @@
<TargetFrameworks>net6.0;net8.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>11.1.0.1</Version>
<Version>11.2.0-beta1</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</AvaloniaVersion>
<AvaloniaVersion>11.2.0-beta1</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

@@ -4,7 +4,7 @@
<PropertyGroup>
<Title>Semi.Avalonia.ColorPicker</Title>
<PackageReleaseNotes>Update to Avalonia 11.1.0</PackageReleaseNotes>
<PackageReleaseNotes>Update to Avalonia 11.1.0.3</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">

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

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

@@ -4,7 +4,7 @@
<PropertyGroup>
<Title>Semi.Avalonia.DataGrid</Title>
<PackageReleaseNotes>Update to Avalonia 11.1.0</PackageReleaseNotes>
<PackageReleaseNotes>Update to Avalonia 11.1.0.3</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">

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

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

@@ -13,6 +13,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
BringIntoViewOnFocusChange="True"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsPresenter
@@ -66,8 +67,7 @@
Name="Container"
Width="{DynamicResource CarouselIndicatorLineWidth}"
Height="{DynamicResource CarouselIndicatorLineHeight}"
Background="{TemplateBinding Background}">
</Border>
Background="{TemplateBinding Background}" />
</Border>
</Panel>
</ControlTemplate>
@@ -90,8 +90,7 @@
<ControlTemplate TargetType="ListBoxItem">
<Panel Background="Transparent">
<Border Padding="2,0" Background="Transparent">
<Border Width="{DynamicResource CarouselIndicatorColumnarWidth}"
Height="{DynamicResource CarouselIndicatorColumnarSelectedHeight}">
<Border Width="{DynamicResource CarouselIndicatorColumnarWidth}" Height="{DynamicResource CarouselIndicatorColumnarSelectedHeight}">
<Rectangle
Name="Container"
Width="{DynamicResource CarouselIndicatorColumnarWidth}"
@@ -100,7 +99,7 @@
Fill="{TemplateBinding Background}">
<Rectangle.Transitions>
<Transitions>
<DoubleTransition Property="Height" Duration="0:0:0.2"></DoubleTransition>
<DoubleTransition Property="Height" Duration="0:0:0.2" />
</Transitions>
</Rectangle.Transitions>
</Rectangle>

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

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

@@ -10,6 +10,7 @@
<Setter Property="ContextMenu.MaxWidth" Value="{DynamicResource MenuFlyoutMaxWidth}" />
<Setter Property="ContextMenu.MinHeight" Value="{DynamicResource MenuFlyoutMinHeight}" />
<Setter Property="ContextMenu.Padding" Value="{DynamicResource MenuFlyoutPadding}" />
<Setter Property="Focusable" Value="True"></Setter>
<Setter Property="ContextMenu.HorizontalAlignment" Value="Stretch" />
<Setter Property="TextBlock.FontWeight" Value="Normal" />
<Setter Property="ContextMenu.WindowManagerAddShadowHint" Value="False" />
@@ -26,7 +27,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
BoxShadow="{DynamicResource MenuFlyoutBorderBoxShadow}"
CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer Theme="{DynamicResource MenuScrollViewer}">
<ScrollViewer Theme="{DynamicResource MenuScrollViewer}" CornerRadius="{TemplateBinding CornerRadius}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Grid.IsSharedSizeScope="True"

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

@@ -4,6 +4,7 @@
xmlns:converters="using:Semi.Avalonia.Converters"
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"
xmlns:internal="clr-namespace:Avalonia.Dialogs.Internal;assembly=Avalonia.Dialogs"
xmlns:cvt="using:Avalonia.Controls.Converters"
x:CompileBindings="True">
<!-- Add Resources Here -->
<Design.PreviewWith>
@@ -194,4 +195,46 @@
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooserOverwritePrompt}"
TargetType="dialogs:ManagedFileChooserOverwritePrompt">
<Setter Property="MaxWidth" Value="400" />
<Setter Property="Padding" Value="10"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}">
<StackPanel Spacing="10">
<TextBlock TextWrapping="Wrap">
<TextBlock.Text>
<MultiBinding>
<MultiBinding.Converter>
<cvt:StringFormatConverter />
</MultiBinding.Converter>
<DynamicResource ResourceKey="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS" />
<TemplateBinding Property="FileName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<StackPanel HorizontalAlignment="Right"
Spacing="10"
Orientation="Horizontal">
<Button Theme="{StaticResource SolidButton}"
Content="{DynamicResource STRING_CHOOSER_DIALOG_OK}"
HorizontalContentAlignment="Center"
IsDefault="True"
Command="{Binding Confirm, RelativeSource={RelativeSource TemplatedParent}}" />
<Button Content="{DynamicResource STRING_CHOOSER_DIALOG_CANCEL}"
IsCancel="True"
HorizontalContentAlignment="Center"
Command="{Binding Cancel, RelativeSource={RelativeSource TemplatedParent}}" />
</StackPanel>
</StackPanel>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@@ -10,73 +10,83 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate TargetType="ScrollViewer">
<DockPanel>
<DockPanel.Styles>
<Style Selector="RepeatButton:pressed">
<Setter Property="RenderTransform" Value="{x:Null}" />
</Style>
</DockPanel.Styles>
<RepeatButton
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
DockPanel.Dock="Top"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}" ConverterParameter="0">
<Binding Path="VerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.IsVisible>
<PathIcon
Width="8"
Height="8"
Data="{DynamicResource MenuScrollViewerUpButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton>
<RepeatButton
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
DockPanel.Dock="Bottom"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}" ConverterParameter="100">
<Binding Path="VerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.IsVisible>
<PathIcon
Width="8"
Height="8"
Data="{DynamicResource MenuScrollViewerDownButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton>
<ScrollContentPresenter
Name="PART_ContentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}"
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}"
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}">
<ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer
CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}"
IsScrollInertiaEnabled="{Binding IsScrollInertiaEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
</ScrollContentPresenter.GestureRecognizers>
</ScrollContentPresenter>
</DockPanel>
<Border
ClipToBounds="True"
CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel>
<DockPanel.Styles>
<Style Selector="RepeatButton:pressed">
<Setter Property="RenderTransform" Value="{x:Null}" />
</Style>
</DockPanel.Styles>
<RepeatButton
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
DockPanel.Dock="Top"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
<MultiBinding
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
ConverterParameter="0">
<Binding Path="VerticalScrollBarVisibility"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.IsVisible>
<PathIcon
Width="8"
Height="8"
Data="{DynamicResource MenuScrollViewerUpButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton>
<RepeatButton
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
DockPanel.Dock="Bottom"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
<MultiBinding
Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
ConverterParameter="100">
<Binding Path="VerticalScrollBarVisibility"
RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Offset.Y" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Extent.Height" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Viewport.Height" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</RepeatButton.IsVisible>
<PathIcon
Width="8"
Height="8"
Data="{DynamicResource MenuScrollViewerDownButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton>
<ScrollContentPresenter
Name="PART_ContentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}"
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}"
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}">
<ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer
CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}"
IsScrollInertiaEnabled="{Binding IsScrollInertiaEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
</ScrollContentPresenter.GestureRecognizers>
</ScrollContentPresenter>
</DockPanel>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
@@ -203,7 +213,7 @@
BorderThickness="{DynamicResource MenuFlyoutBorderThickness}"
BoxShadow="{DynamicResource MenuFlyoutBorderBoxShadow}"
CornerRadius="{DynamicResource MenuFlyoutCornerRadius}">
<ScrollViewer Theme="{StaticResource MenuScrollViewer}">
<ScrollViewer Theme="{StaticResource MenuScrollViewer}" CornerRadius="{DynamicResource MenuFlyoutCornerRadius}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Grid.IsSharedSizeScope="True"
@@ -327,7 +337,7 @@
BorderThickness="{DynamicResource MenuFlyoutBorderThickness}"
BoxShadow="{DynamicResource MenuFlyoutBorderBoxShadow}"
CornerRadius="{DynamicResource MenuFlyoutCornerRadius}">
<ScrollViewer Theme="{StaticResource MenuScrollViewer}">
<ScrollViewer Theme="{StaticResource MenuScrollViewer}" CornerRadius="{DynamicResource MenuFlyoutCornerRadius}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Grid.IsSharedSizeScope="True"

View File

@@ -2,7 +2,21 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<!-- Add Resources Here -->
<Design.PreviewWith>
<ThemeVariantScope RequestedThemeVariant="Dark">
<MenuFlyoutPresenter>
<MenuFlyoutPresenter.Items>
<MenuItem Header="Menu Item 1" />
<MenuItem Header="Menu Item 2" />
<MenuItem Header="Menu Item 3" />
<MenuItem Header="Menu Item 4" />
<MenuItem Header="Menu Item 5" />
<MenuItem Header="Menu Item 6" />
</MenuFlyoutPresenter.Items>
</MenuFlyoutPresenter>
</ThemeVariantScope>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type MenuFlyoutPresenter}" TargetType="MenuFlyoutPresenter">
<Setter Property="MenuFlyoutPresenter.Background" Value="{DynamicResource MenuFlyoutBackground}" />
<Setter Property="MenuFlyoutPresenter.BorderBrush" Value="{DynamicResource MenuFlyoutBorderBrush}" />
@@ -23,12 +37,13 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
BoxShadow="{DynamicResource MenuFlyoutBorderBoxShadow}"
ClipToBounds="False"
ClipToBounds="True"
CornerRadius="{TemplateBinding CornerRadius}"
UseLayoutRounding="False">
<ScrollViewer
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
Theme="{StaticResource MenuScrollViewer}"
CornerRadius="{TemplateBinding CornerRadius}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter
Name="PART_ItemsPresenter"

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

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

@@ -5,7 +5,6 @@
<MenuFlyout x:Key="SelectableTextBlockContextFlyout" Placement="Bottom">
<MenuItem
x:Name="SelectableTextBlockContextFlyoutCopyItem"
Command="{Binding $parent[SelectableTextBlock].Copy}"
Header="{DynamicResource STRING_MENU_COPY}"
InputGesture="{x:Static TextBox.CopyGesture}"

View File

@@ -4,19 +4,16 @@
x:CompileBindings="True">
<MenuFlyout x:Key="DefaultTextBoxContextFlyout" Placement="Bottom">
<MenuItem
x:Name="TextBoxContextFlyoutCutItem"
Command="{Binding $parent[TextBox].Cut}"
Header="{DynamicResource STRING_MENU_CUT}"
InputGesture="{x:Static TextBox.CutGesture}"
IsEnabled="{Binding $parent[TextBox].CanCut}" />
<MenuItem
x:Name="TextBoxContextFlyoutCopyItem"
Command="{Binding $parent[TextBox].Copy}"
Header="{DynamicResource STRING_MENU_COPY}"
InputGesture="{x:Static TextBox.CopyGesture}"
IsEnabled="{Binding $parent[TextBox].CanCopy}" />
<MenuItem
x:Name="TextBoxContextFlyoutPasteItem"
Command="{Binding $parent[TextBox].Paste}"
Header="{DynamicResource STRING_MENU_PASTE}"
InputGesture="{x:Static TextBox.PasteGesture}"
@@ -24,29 +21,6 @@
</MenuFlyout>
<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.Cursor" Value="Hand" />
<Setter Property="ToggleButton.Template">
<ControlTemplate TargetType="ToggleButton">
<!-- Background must be transparent or hit test will fail -->
<Panel Background="Transparent">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource PasswordBoxRevealButtonData}"
IsVisible="{Binding $parent[ToggleButton].IsChecked, Converter={x:Static BoolConverters.Not}}" />
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource PasswordBoxHideButtonData}"
IsVisible="{Binding $parent[ToggleButton].IsChecked}" />
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ControlTheme.Resources>
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxForeground}" />
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDefaultBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
@@ -120,8 +94,7 @@
SelectionEnd="{TemplateBinding SelectionEnd}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
SelectionStart="{TemplateBinding SelectionStart}"
Text="{TemplateBinding Text,
Mode=TwoWay}"
Text="{TemplateBinding Text, Mode=TwoWay}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
</Panel>
@@ -137,8 +110,7 @@
Name="PART_RevealButton"
Grid.Column="3"
Margin="4,0,0,0"
IsChecked="{TemplateBinding RevealPassword,
Mode=TwoWay}"
IsChecked="{TemplateBinding RevealPassword, Mode=TwoWay}"
IsVisible="False"
Theme="{StaticResource InputToggleButton}" />
<ContentPresenter
@@ -247,10 +219,10 @@
</Style>
<Style Selector="^.TextArea">
<Setter Property="AcceptsReturn" Value="True"></Setter>
<Setter Property="VerticalContentAlignment" Value="Top"></Setter>
<Setter Property="TextBox.Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}"></Setter>
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}"></Setter>
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
</Style>
</ControlTheme>
@@ -260,8 +232,8 @@
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
<Setter Property="TextBox.SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
<Setter Property="TextBox.SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
<Setter Property="TextBox.BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="TextBox.BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
<Setter Property="TextBox.BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="TextBox.CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
<Setter Property="TextBox.FontSize" Value="14" />
<Setter Property="TextBox.Cursor" Value="Ibeam" />
@@ -284,7 +256,7 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto, *, Auto">
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto,*,Auto, Auto, Auto">
<ContentPresenter
Grid.Column="0"
Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
@@ -303,17 +275,22 @@
Name="PART_Watermark"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsVisible="{TemplateBinding Text,
Converter={x:Static StringConverters.IsNullOrEmpty}}"
Opacity="0.5"
Text="{TemplateBinding Watermark}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
TextWrapping="{TemplateBinding TextWrapping}">
<TextBlock.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding ElementName="PART_TextPresenter" Path="PreeditText" Converter="{x:Static StringConverters.IsNullOrEmpty}"/>
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Text" Converter="{x:Static StringConverters.IsNullOrEmpty}"/>
</MultiBinding>
</TextBlock.IsVisible>
</TextBlock>
<TextPresenter
Name="PART_TextPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
CaretBrush="{TemplateBinding CaretBrush}"
CaretIndex="{TemplateBinding CaretIndex}"
LineHeight="{TemplateBinding LineHeight}"
@@ -323,14 +300,27 @@
SelectionEnd="{TemplateBinding SelectionEnd}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
SelectionStart="{TemplateBinding SelectionStart}"
Text="{TemplateBinding Text,
Mode=TwoWay}"
Text="{TemplateBinding Text, Mode=TwoWay}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
</Panel>
</ScrollViewer>
<ContentPresenter
<Button
Name="PART_ClearButton"
Grid.Column="2"
Command="{Binding $parent[TextBox].Clear}"
Content="{DynamicResource IconButtonClearData}"
IsVisible="False"
Theme="{StaticResource InnerIconButton}" />
<ToggleButton
Name="PART_RevealButton"
Grid.Column="3"
Margin="4,0,0,0"
IsChecked="{TemplateBinding RevealPassword, Mode=TwoWay}"
IsVisible="False"
Theme="{StaticResource InputToggleButton}" />
<ContentPresenter
Grid.Column="4"
Padding="{DynamicResource TextBoxInnerRightContentPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding InnerRightContent}"
@@ -377,6 +367,69 @@
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
<Setter Property="IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.Large">
<Setter Property="MinHeight" Value="{DynamicResource TextBoxLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Setter Property="MinHeight" Value="{DynamicResource TextBoxSmallHeight}" />
</Style>
<Style Selector="^.Bordered">
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedDefaultBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedDefaultBorderBrush}" />
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:focus">
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ Border#PART_ContentPresenterBorder">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDisabledBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
</Style>
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</Style>
<Style Selector="^.TextArea">
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="LooklessTextBox" TargetType="TextBox">
@@ -454,4 +507,32 @@
</Style>
</ControlTheme>
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
<Setter Property="ToggleButton.Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
<Setter Property="ToggleButton.Cursor" Value="Hand" />
<Setter Property="ToggleButton.Template">
<ControlTemplate TargetType="ToggleButton">
<!-- Background must be transparent or hit test will fail -->
<Panel Background="Transparent">
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource PasswordBoxRevealButtonData}"
IsVisible="{Binding $parent[ToggleButton].IsChecked, Converter={x:Static BoolConverters.Not}}" />
<PathIcon
Width="16"
Height="16"
Data="{DynamicResource PasswordBoxHideButtonData}"
IsVisible="{Binding $parent[ToggleButton].IsChecked}" />
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPointeroverForeground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPressedForeground}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -54,8 +54,20 @@
<RepeatButton Name="PART_MinuteUpButton" Theme="{StaticResource DateTimePickerUpButton}" />
<RepeatButton Name="PART_MinuteDownButton" Theme="{StaticResource DateTimePickerDownButton}" />
</Panel>
<Panel Name="PART_SecondHost" Grid.Column="4">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel
Name="PART_SecondSelector"
ItemHeight="{DynamicResource DateTimePickerListBoxItemHeight}"
PanelType="Second"
ShouldLoop="True" />
</ScrollViewer>
<RepeatButton Name="PART_SecondUpButton" Theme="{StaticResource DateTimePickerUpButton}" />
<RepeatButton Name="PART_SecondDownButton" Theme="{StaticResource DateTimePickerDownButton}" />
</Panel>
<Panel Name="PART_PeriodHost" Grid.Column="4">
<Panel Name="PART_PeriodHost" Grid.Column="6">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel
Name="PART_PeriodSelector"
@@ -81,6 +93,13 @@
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Rectangle
Name="PART_ThirdSpacer"
Grid.Column="5"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
</Grid>
<Grid
@@ -216,6 +235,29 @@
Grid.Column="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_SecondTextBlock"
Padding="12,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="{DynamicResource STRING_TIMEPICKER_SECOND_TEXT}"/>
</Border>
<Rectangle
Name="PART_ThirdColumnDivider"
Grid.Column="5"
Width="1"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Border
x:Name="PART_FourthPickerHost"
Grid.Column="6"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_PeriodTextBlock"
Padding="12,0"

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,76 +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}}"
RecognizesAccessKey="True" />
<Grid
Grid.Row="1"
Background="Transparent"
ColumnDefinitions="Auto, *">
<Grid
Grid.Column="0"
Grid.ColumnSpan="2"
TemplatedControl.IsTemplateFocusTarget="True" />
<Border
x:Name="SwitchBackgroundBorder"
Grid.Column="0"
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"
<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"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
HorizontalAlignment="Left">
<Grid
x:Name="PART_MovingKnobs"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
HorizontalAlignment="Left">
<Grid
x:Name="PART_MovingKnobs"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Margin="{DynamicResource ToggleSwitchIndicatorDefaultMargin}">
<Border
x:Name="SwitchKnobIndicator"
Background="White"
BoxShadow="0 0 1 1 #222E3238"
CornerRadius="100" />
</Grid>
</Canvas>
</Border>
Margin="{DynamicResource ToggleSwitchIndicatorDefaultMargin}">
<Border
x:Name="SwitchKnobIndicator"
Background="White"
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>
@@ -149,6 +179,22 @@
<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}" />
@@ -163,6 +209,9 @@
<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">
@@ -178,6 +227,9 @@
<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>
@@ -188,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
@@ -196,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}"
@@ -209,7 +267,7 @@
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Grid>
</Panel>
</Border>
</ControlTemplate>
</Setter>
@@ -225,29 +283,29 @@
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"
ColumnDefinitions="Auto, *">
Width="{DynamicResource ToggleSwitchDefaultWidth}"
Height="{DynamicResource ToggleSwitchDefaultHeight}"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
<Grid
Grid.Column="0"
Grid.ColumnSpan="2"
TemplatedControl.IsTemplateFocusTarget="True" />
<Border
x:Name="SwitchBackgroundBorder"
Grid.Column="0"
Width="{DynamicResource ToggleSwitchDefaultWidth}"
Height="{DynamicResource ToggleSwitchDefaultHeight}"
CornerRadius="100">
<Border.Transitions>
<Transitions>
<BrushTransition Property="Background" Duration="0:0:0.2" />
</Transitions>
</Border.Transitions>
ColumnDefinitions="*,*">
<Canvas
x:Name="PART_SwitchKnob"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
Height="{DynamicResource ToggleSwitchIndicatorDefaultWidth}"
HorizontalAlignment="Left">
@@ -261,11 +319,74 @@
Background="White"
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>
</Grid>
<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>
</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

@@ -8,6 +8,7 @@
<!-- TimePicker -->
<x:String x:Key="STRING_TIMEPICKER_HOUR_TEXT">hour</x:String>
<x:String x:Key="STRING_TIMEPICKER_MINUTE_TEXT">minute</x:String>
<x:String x:Key="STRING_TIMEPICKER_SECOND_TEXT">second</x:String>
<!-- TextBox/SelectableTextBox flyout -->
<x:String x:Key="STRING_MENU_CUT">Cut</x:String>
<x:String x:Key="STRING_MENU_COPY">Copy</x:String>
@@ -21,4 +22,5 @@
<x:String x:Key="STRING_CHOOSER_DATEMODIFIED_COLUMN">Date Modified</x:String>
<x:String x:Key="STRING_CHOOSER_TYPE_COLUMN">Type</x:String>
<x:String x:Key="STRING_CHOOSER_SIZE_COLUMN">Size</x:String>
<x:String x:Key="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS">{0} already exists. Do you want to replace it?</x:String>
</ResourceDictionary>

View File

@@ -0,0 +1,25 @@
<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>
<x:String x:Key="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS">{0} はすでに存在します。置き換えますか?</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,26 @@
<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>
<x:String x:Key="STRING_TIMEPICKER_SECOND_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">Отмена</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>
<x:String x:Key="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS">{0} уже существует. Вы хотите заменить его?</x:String>
</ResourceDictionary>

View File

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

View File

@@ -8,6 +8,7 @@
<!-- TimePicker -->
<x:String x:Key="STRING_TIMEPICKER_HOUR_TEXT">时</x:String>
<x:String x:Key="STRING_TIMEPICKER_MINUTE_TEXT">分</x:String>
<x:String x:Key="STRING_TIMEPICKER_SECOND_TEXT">秒</x:String>
<!-- TextBox/SelectableTextBox flyout -->
<x:String x:Key="STRING_MENU_CUT">剪切</x:String>
<x:String x:Key="STRING_MENU_COPY">复制</x:String>
@@ -21,4 +22,5 @@
<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>
<x:String x:Key="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS">{0} 已经存在。您要替换它吗?</x:String>
</ResourceDictionary>

View File

@@ -4,7 +4,7 @@
<PropertyGroup>
<Title>Semi.Avalonia</Title>
<PackageReleaseNotes>Update to Avalonia 11.1.0</PackageReleaseNotes>
<PackageReleaseNotes>Update to Avalonia 11.1.0.3</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">

View File

@@ -1,3 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="AdornerLayerBackground" Color="White" />
<SolidColorBrush x:Key="AdornerLayerStroke" Opacity="0.4" Color="#54A9FF" />
</ResourceDictionary>

View File

@@ -1,5 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BoxShadows x:Key="AutoCompleteBoxPopupBoxShadow">0 0 8 0 #1AFFFFFF</BoxShadows>
<SolidColorBrush x:Key="AutoCompleteBoxPopupBackground" Color="#35363C" />
<SolidColorBrush x:Key="AutoCompleteBoxPopupBackground" Color="#43444A" />
<SolidColorBrush x:Key="AutoCompleteBoxPopupBorderBrush" Opacity="0.08" Color="White" />
</ResourceDictionary>

View File

@@ -82,7 +82,7 @@
<SolidColorBrush x:Key="ButtonOutlineDangerBorderBrush" Color="#FC725A" />
<!-- end Outline -->
<SolidColorBrush x:Key="ButtonInputInnerForeground" Color="#888D92" />
<SolidColorBrush x:Key="ButtonInputInnerPointeroverForeground" Color="#A7ABB0" />
<SolidColorBrush x:Key="ButtonInputInnerPressedForeground" Color="#C6CACD" />
<SolidColorBrush x:Key="ButtonInputInnerForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="ButtonInputInnerPointeroverForeground" Color="#7FC1FF" />
<SolidColorBrush x:Key="ButtonInputInnerPressedForeground" Color="#A9D7FF" />
</ResourceDictionary>

View File

@@ -1,17 +1,17 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="CalendarBackground" Color="#232429" />
<SolidColorBrush x:Key="CalendarBackground" Color="#43444A" />
<SolidColorBrush x:Key="CalendarForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="CalendarItemWeekDayNameForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarItemIconForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonBackground" Color="#232429" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonBackground" Color="#43444A" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonPointeroverBackground" Opacity="0.16" Color="White" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonPressedBackground" Opacity="0.20" Color="White" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonSelectedBackground" Color="#54A9FF" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonSelectedForeground" Color="#232429" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonSelectedForeground" Color="#43444A" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonDisabledForeground" Opacity="0.35" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonBlackoutForeground" Opacity="0.35" Color="#F9F9F9" />
<SolidColorBrush x:Key="CalendarItemCalendarButtonInactiveForeground" Opacity="0.65" Color="#F9F9F9" />
@@ -24,7 +24,7 @@
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonPressedBackground" Opacity="0.20" Color="White" />
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonSelectedBackground" Color="#54A9FF" />
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonSelectedForeground" Color="#232429" />
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonSelectedForeground" Color="#43444A" />
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonTodayForeground" Color="#54A9FF" />
<SolidColorBrush x:Key="CalendarItemCalendarDayButtonTodayBackground" Opacity="0.12" Color="White" />

View File

@@ -18,7 +18,7 @@
<SolidColorBrush x:Key="ComboBoxDisabledForeground" Opacity="0.35" Color="#F9F9F9" />
<BoxShadows x:Key="ComboBoxPopupBoxShadow">0 0 8 0 #1AFFFFFF</BoxShadows>
<SolidColorBrush x:Key="ComboBoxPopupBackground" Color="#35363C" />
<SolidColorBrush x:Key="ComboBoxPopupBackground" Color="#43444A" />
<SolidColorBrush x:Key="ComboBoxPopupBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="ComboBoxItemForeground" Color="#F9F9F9" />

View File

@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="DateTimePickerListItemBackground" Color="Transparent" />
<SolidColorBrush x:Key="DateTimePickerPopupBackground" Color="#35363C" />
<SolidColorBrush x:Key="DateTimePickerPopupBackground" Color="#43444A" />
<SolidColorBrush x:Key="DateTimePickerFlyoutButtonForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="DateTimePickerFlyoutButtonPointeroverForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="DateTimePickerFlyoutButtonPressedForeground" Color="#F9F9F9" />

View File

@@ -1,5 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="FlyoutBackground" Color="#35363C" />
<SolidColorBrush x:Key="FlyoutBackground" Color="#43444A" />
<SolidColorBrush x:Key="FlyoutForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="FlyoutBorderBrush" Opacity="0.08" Color="White" />
<BoxShadows x:Key="FlyoutBorderBoxShadow">0 0 8 0 #1AFFFFFF</BoxShadows>

View File

@@ -2,12 +2,12 @@
<SolidColorBrush x:Key="MenuFlyoutScrollViewerIconForeground" Opacity="0.6" Color="#F9F9F9" />
<!-- MenuFlyout -->
<SolidColorBrush x:Key="MenuFlyoutBackground" Color="#35363C" />
<SolidColorBrush x:Key="MenuFlyoutBackground" Color="#43444A" />
<SolidColorBrush x:Key="MenuFlyoutBorderBrush" Opacity="0.08" Color="White" />
<BoxShadows x:Key="MenuFlyoutBorderBoxShadow">0 0 8 0 #1AFFFFFF</BoxShadows>
<!-- MenuItem -->
<SolidColorBrush x:Key="MenuItemBackground" Color="#35363C" />
<SolidColorBrush x:Key="MenuItemBackground" Color="#43444A" />
<SolidColorBrush x:Key="MenuItemForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="MenuItemSeparatorBackground" Opacity="0.08" Color="White" />

View File

@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="NotificationCardForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="NotificationCardBorderBrush" Opacity="0.08" Color="White" />
<SolidColorBrush x:Key="NotificationCardBackground" Color="#43444A" />
<SolidColorBrush x:Key="NotificationCardInformationIconForeground" Color="#54A9FF" />
@@ -7,4 +6,6 @@
<SolidColorBrush x:Key="NotificationCardWarningIconForeground" Color="#FFAE43" />
<SolidColorBrush x:Key="NotificationCardErrorIconForeground" Color="#FC725A" />
<BoxShadows x:Key="NotificationCardBoxShadows">0 0 8 0 #1AFFFFFF</BoxShadows>
<SolidColorBrush x:Key="NotificationCardTitleForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="NotificationCardMessageForeground" Opacity="0.8" Color="#F9F9F9" />
</ResourceDictionary>

View File

@@ -9,9 +9,6 @@
<SolidColorBrush x:Key="TextBoxForeground" Color="#F9F9F9" />
<SolidColorBrush x:Key="TextBoxInnerForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="TextBoxButtonDefaultForeground" Opacity="0.2" Color="#E6E8EA" />
<SolidColorBrush x:Key="TextBoxButtonPointeroverForeground" Opacity="0.4" Color="#E6E8EA" />
<SolidColorBrush x:Key="TextBoxDisabledBackground" Opacity="0.04" Color="#E6E8EA" />
<SolidColorBrush x:Key="TextBoxDisabledForeground" Opacity="0.35" Color="#F9F9F9" />
<SolidColorBrush x:Key="TextBoxDisabledBorderBrush" Color="Transparent" />

View File

@@ -10,4 +10,7 @@
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedPointeroverBackground" Color="#7FD184" />
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedPressedBackground" Color="#A6E1A8" />
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedDisabledBackground" Color="#277731" />
<SolidColorBrush x:Key="SimpleToggleSwitchContainerUnCheckedForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="SimpleToggleSwitchContainerCheckedForeground" Color="White" />
</ResourceDictionary>

View File

@@ -1,3 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="AdornerLayerBackground" Color="#1C1F23" />
<SolidColorBrush x:Key="AdornerLayerStroke" Color="#98CDFD" />
</ResourceDictionary>

View File

@@ -82,7 +82,7 @@
<SolidColorBrush x:Key="ButtonOutlineDangerBorderBrush" Color="#F93920" />
<!-- end Outline -->
<SolidColorBrush x:Key="ButtonInputInnerForeground" Color="#6B7075" />
<SolidColorBrush x:Key="ButtonInputInnerPointeroverForeground" Color="#555B61" />
<SolidColorBrush x:Key="ButtonInputInnerPressedForeground" Color="#41464C" />
<SolidColorBrush x:Key="ButtonInputInnerForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="ButtonInputInnerPointeroverForeground" Color="#0062D6" />
<SolidColorBrush x:Key="ButtonInputInnerPressedForeground" Color="#004FB3" />
</ResourceDictionary>

View File

@@ -1,6 +1,4 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="CalendarBackground" Color="White" />
<SolidColorBrush x:Key="CalendarForeground" Color="#1C1F23" />
<SolidColorBrush x:Key="CalendarBorderBrush" Opacity="0.08" Color="#1C1F23" />

View File

@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="NotificationCardForeground" Color="#1C1F23" />
<SolidColorBrush x:Key="NotificationCardBorderBrush" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="NotificationCardBackground" Color="White" />
<SolidColorBrush x:Key="NotificationCardInformationIconForeground" Color="#0077FA" />
@@ -7,4 +6,6 @@
<SolidColorBrush x:Key="NotificationCardWarningIconForeground" Color="#FC8800" />
<SolidColorBrush x:Key="NotificationCardErrorIconForeground" Color="#F93920" />
<BoxShadows x:Key="NotificationCardBoxShadows">0 0 8 0 #1A000000</BoxShadows>
<SolidColorBrush x:Key="NotificationCardTitleForeground" Color="#1C1F23" />
<SolidColorBrush x:Key="NotificationCardMessageForeground" Opacity="0.8" Color="#1C1F23" />
</ResourceDictionary>

View File

@@ -9,9 +9,6 @@
<SolidColorBrush x:Key="TextBoxForeground" Color="#1C1F23" />
<SolidColorBrush x:Key="TextBoxInnerForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="TextBoxButtonDefaultForeground" Opacity="0.08" Color="#1C1F23" />
<SolidColorBrush x:Key="TextBoxButtonPointeroverForeground" Color="#0077FA" />
<SolidColorBrush x:Key="TextBoxDisabledBackground" Opacity="0.02" Color="#2E3238" />
<SolidColorBrush x:Key="TextBoxDisabledForeground" Opacity="0.35" Color="#1C1F23" />
<SolidColorBrush x:Key="TextBoxDisabledBorderBrush" Color="Transparent" />

View File

@@ -10,4 +10,7 @@
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedPointeroverBackground" Color="#30953B" />
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedPressedBackground" Color="#25772F" />
<SolidColorBrush x:Key="ToggleSwitchContainerCheckedDisabledBackground" Color="#A4E0A7" />
<SolidColorBrush x:Key="SimpleToggleSwitchContainerUnCheckedForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="SimpleToggleSwitchContainerCheckedForeground" Color="White" />
</ResourceDictionary>

View File

@@ -8,14 +8,16 @@ using Semi.Avalonia.Locale;
namespace Semi.Avalonia;
public class SemiTheme: Styles
public class SemiTheme : Styles
{
private static readonly Dictionary<CultureInfo, ResourceDictionary> _localeToResource = new()
{
{ new CultureInfo("zh-cn"), new zh_cn() },
{ new CultureInfo("en-us"), new en_us() },
{ new CultureInfo("ja-jp"), new ja_jp() },
{ new CultureInfo("ru-ru"), new ru_ru() },
};
private readonly IServiceProvider? sp;
public SemiTheme(IServiceProvider? provider = null)
{
@@ -28,17 +30,17 @@ public class SemiTheme: Styles
{
get => _locale;
set
{
{
_locale = value;
var resource = TryGetLocaleResource(value);
if(resource is null) return;
if (resource is null) return;
foreach (var kv in resource)
{
this.Resources.Add(kv);
}
}
}
private static ResourceDictionary? TryGetLocaleResource(CultureInfo? locale)
{
if (locale is null)

View File

@@ -1,4 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Thickness x:Key="AdornerLayerMargin">1</Thickness>
<x:Double x:Key="AdornerLayerThickness">1</x:Double>
<Thickness x:Key="AdornerLayerBorderThickness">2</Thickness>
</ResourceDictionary>

View File

@@ -6,7 +6,7 @@
<!-- MenuFlyout -->
<Thickness x:Key="MenuFlyoutBorderThickness">1</Thickness>
<Thickness x:Key="MenuFlyoutPadding">8</Thickness>
<Thickness x:Key="MenuFlyoutPadding">0</Thickness>
<CornerRadius x:Key="MenuFlyoutCornerRadius">6</CornerRadius>
<x:Double x:Key="MenuFlyoutMinHeight">16</x:Double>
<x:Double x:Key="MenuFlyoutMinWidth">100</x:Double>

View File

@@ -1,9 +1,22 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="NotificationCardWidth">320</x:Double>
<x:Double x:Key="NotificationCardMinWidth">320</x:Double>
<Thickness x:Key="NotificationCardBorderThickness">1</Thickness>
<CornerRadius x:Key="NotificationCardCornerRadius">6</CornerRadius>
<Geometry x:Key="NotificationCardInformationIconPathData">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 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</Geometry>
<Geometry x:Key="NotificationCardSuccessIconPathData">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.8831 9.82235L11.6854 17.4112C11.4029 17.7806 10.965 17.9981 10.5 18C10.035 18.0019 9.59533 17.788 9.30982 17.421L5.81604 13.4209C5.30744 12.767 5.42524 11.8246 6.07916 11.316C6.73308 10.8074 7.67549 10.9252 8.1841 11.5791L10.4838 14.0439L15.5 8C16.0032 7.34193 16.9446 7.21641 17.6027 7.71964C18.2608 8.22287 18.3863 9.16428 17.8831 9.82235Z</Geometry>
<Geometry x:Key="NotificationCardWarningIconPathData">M10.2268 2.3986L1.52616 19.0749C0.831449 20.4064 1.79747 22 3.29933 22H20.7007C22.2025 22 23.1686 20.4064 22.4739 19.0749L13.7732 2.3986C13.0254 0.965441 10.9746 0.965442 10.2268 2.3986ZM13.1415 14.0101C13.0603 14.5781 12.5739 15 12.0001 15C11.4263 15 10.9398 14.5781 10.8586 14.0101L10.2829 9.97992C10.1336 8.93495 10.9445 8.00002 12.0001 8.00002C13.0556 8.00002 13.8665 8.93495 13.7172 9.97992L13.1415 14.0101ZM13.5001 18.5C13.5001 19.3284 12.8285 20 12.0001 20C11.1716 20 10.5001 19.3284 10.5001 18.5C10.5001 17.6716 11.1716 17 12.0001 17C12.8285 17 13.5001 17.6716 13.5001 18.5Z</Geometry>
<Geometry x:Key="NotificationCardErrorIconPathData">M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12ZM13.5 17.5C13.5 16.6716 12.8284 16 12 16C11.1716 16 10.5 16.6716 10.5 17.5C10.5 18.3284 11.1716 19 12 19C12.8284 19 13.5 18.3284 13.5 17.5ZM12 5C10.9138 5 10.0507 5.91244 10.1109 6.99692L10.4168 12.5023C10.4635 13.3426 11.1584 14 12 14C12.8416 14 13.5365 13.3426 13.5832 12.5023L13.8891 6.99692C13.9493 5.91244 13.0862 5 12 5Z</Geometry>
<Thickness x:Key="NotificationCardMargin">8</Thickness>
<Thickness x:Key="NotificationCardPadding">16 12</Thickness>
<x:Double x:Key="NotificationCardIconWidth">18</x:Double>
<x:Double x:Key="NotificationCardIconHeight">18</x:Double>
<Thickness x:Key="NotificationCardIconMargin">0 0 12 0</Thickness>
<StreamGeometry x:Key="NotificationCardInformationIconPathData">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 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</StreamGeometry>
<StreamGeometry x:Key="NotificationCardSuccessIconPathData">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.8831 9.82235L11.6854 17.4112C11.4029 17.7806 10.965 17.9981 10.5 18C10.035 18.0019 9.59533 17.788 9.30982 17.421L5.81604 13.4209C5.30744 12.767 5.42524 11.8246 6.07916 11.316C6.73308 10.8074 7.67549 10.9252 8.1841 11.5791L10.4838 14.0439L15.5 8C16.0032 7.34193 16.9446 7.21641 17.6027 7.71964C18.2608 8.22287 18.3863 9.16428 17.8831 9.82235Z</StreamGeometry>
<StreamGeometry x:Key="NotificationCardWarningIconPathData">M10.2268 2.3986L1.52616 19.0749C0.831449 20.4064 1.79747 22 3.29933 22H20.7007C22.2025 22 23.1686 20.4064 22.4739 19.0749L13.7732 2.3986C13.0254 0.965441 10.9746 0.965442 10.2268 2.3986ZM13.1415 14.0101C13.0603 14.5781 12.5739 15 12.0001 15C11.4263 15 10.9398 14.5781 10.8586 14.0101L10.2829 9.97992C10.1336 8.93495 10.9445 8.00002 12.0001 8.00002C13.0556 8.00002 13.8665 8.93495 13.7172 9.97992L13.1415 14.0101ZM13.5001 18.5C13.5001 19.3284 12.8285 20 12.0001 20C11.1716 20 10.5001 19.3284 10.5001 18.5C10.5001 17.6716 11.1716 17 12.0001 17C12.8285 17 13.5001 17.6716 13.5001 18.5Z</StreamGeometry>
<StreamGeometry x:Key="NotificationCardErrorIconPathData">M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12ZM13.5 17.5C13.5 16.6716 12.8284 16 12 16C11.1716 16 10.5 16.6716 10.5 17.5C10.5 18.3284 11.1716 19 12 19C12.8284 19 13.5 18.3284 13.5 17.5ZM12 5C10.9138 5 10.0507 5.91244 10.1109 6.99692L10.4168 12.5023C10.4635 13.3426 11.1584 14 12 14C12.8416 14 13.5365 13.3426 13.5832 12.5023L13.8891 6.99692C13.9493 5.91244 13.0862 5 12 5Z</StreamGeometry>
<x:Double x:Key="NotificationCardTitleSpacing">4</x:Double>
<x:Double x:Key="NotificationCardTitleFontSize">16</x:Double>
<FontWeight x:Key="NotificationCardTitleFontWeight">600</FontWeight>
<x:Double x:Key="NotificationCardMessageFontSize">14</x:Double>
<FontWeight x:Key="NotificationCardMessageFontWeight">400</FontWeight>
</ResourceDictionary>

View File

@@ -13,6 +13,6 @@
<Thickness x:Key="TextBoxTextAreaContentPadding">12 5</Thickness>
<x:Double x:Key="TextBoxTextAreaHeight">90</x:Double>
<StreamGeometry x:Key="PasswordBoxRevealButtonData">M12 4C5 4 1 10 1 12C1 14 5 20 12 20C19 20 23 14 23 12C23 10 19 4 12 4ZM17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12ZM12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxHideButtonData">M2.02949 4.67856C2.7593 4.28654 3.66871 4.56038 4.06073 5.29018C6.21313 9.29726 8.83179 11.5 12.0001 11.5C15.1685 11.5 17.7871 9.29726 19.9395 5.29018C20.3315 4.56038 21.241 4.28655 21.9708 4.67856C22.7006 5.07058 22.9744 5.97999 22.5824 6.7098C21.9049 7.97104 21.1385 9.15419 20.2743 10.199L23.2001 14.1C23.6971 14.7627 23.5628 15.7029 22.9001 16.2C22.2373 16.697 21.2971 16.5627 20.8001 15.9L18.1186 12.3246C17.448 12.8501 16.7322 13.2957 15.9687 13.6441L17.4046 17.4733C17.6955 18.249 17.3025 19.1136 16.5268 19.4045C15.7511 19.6954 14.8865 19.3024 14.5956 18.5267L13.0956 14.5267C13.0852 14.4988 13.0756 14.4709 13.0669 14.4428C12.7193 14.4806 12.3638 14.5 12.0001 14.5C11.6365 14.5 11.281 14.4806 10.9333 14.4428C10.9246 14.4709 10.9151 14.4988 10.9046 14.5267L9.40463 18.5267C9.11375 19.3024 8.24913 19.6954 7.47345 19.4045C6.69777 19.1136 6.30476 18.249 6.59564 17.4733L8.03159 13.6441C7.26806 13.2957 6.55223 12.8501 5.88163 12.3246L3.20009 15.9C2.70303 16.5627 1.76283 16.697 1.10009 16.2C0.437347 15.7029 0.303032 14.7627 0.800088 14.1L3.72589 10.1989C2.86177 9.15415 2.09533 7.97101 1.41787 6.70979C1.02585 5.97999 1.29969 5.07057 2.02949 4.67856Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxRevealButtonData">M21.7071 3.70711C22.0976 3.31658 22.0976 2.68342 21.7071 2.29289C21.3166 1.90237 20.6834 1.90237 20.2929 2.29289L17.3135 5.27233C15.8114 4.50566 14.0321 4 12 4C5 4 1 10 1 12C1 13.1757 2.38219 15.7335 4.94345 17.6423L2.29289 20.2929C1.90237 20.6834 1.90237 21.3166 2.29289 21.7071C2.68342 22.0976 3.31658 22.0976 3.70711 21.7071L21.7071 3.70711ZM7.8284 14.7574L9.29237 13.2934C9.10495 12.9018 9 12.4631 9 12C9 10.3431 10.3431 9 12 9C12.4631 9 12.9018 9.10495 13.2934 9.29237L14.7574 7.8284C13.967 7.30488 13.0191 7 12 7C9.23858 7 7 9.23858 7 12C7 13.0191 7.30488 13.967 7.8284 14.7574Z M12 20C10.7789 20 9.64914 19.8174 8.61594 19.5054L11.1871 16.9342C11.4516 16.9775 11.7232 17 12 17C14.7614 17 17 14.7614 17 12C17 11.7232 16.9775 11.4516 16.9342 11.1871L20.5032 7.61808C22.1342 9.27317 23 11.0695 23 12C23 14 19 20 12 20Z</StreamGeometry>
<StreamGeometry x:Key="PasswordBoxHideButtonData">M12 4C5 4 1 10 1 12C1 14 5 20 12 20C19 20 23 14 23 12C23 10 19 4 12 4ZM17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12ZM12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z</StreamGeometry>
</ResourceDictionary>

View File

@@ -11,10 +11,14 @@
<Thickness x:Key="ToggleSwitchIndicatorDefaultMargin">2 0 0 0</Thickness>
<Thickness x:Key="ToggleSwitchIndicatorSmallMargin">1 0 0 0</Thickness>
<Thickness x:Key="ToggleSwitchIndicatorLargeMargin">3 0 0 0</Thickness>
<x:Double x:Key="ToggleSwitchLoadingIndicatorSmallStrokeThickness">1</x:Double>
<x:Double x:Key="ToggleSwitchLoadingIndicatorLargeStrokeThickness">3</x:Double>
<x:Double x:Key="ToggleSwitchDefaultFontSize">12</x:Double>
<x:Double x:Key="ToggleSwitchLargeFontSize">14</x:Double>
<Thickness x:Key="ToggleSwitchHeaderMargin">8 4</Thickness>
<Thickness x:Key="ToggleSwitchOnContentMargin">8 4</Thickness>
<x:Double x:Key="SimpleToggleSwitchFontSize">14</x:Double>
</ResourceDictionary>