mirror of
https://gitee.com/chinware/atomui.git
synced 2024-11-29 18:38:16 +08:00
* 格式化代码;
This commit is contained in:
parent
480a9be15c
commit
80638627ee
@ -6,7 +6,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)\build\Version.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)\build\Output.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)\build\Version.props"/>
|
||||
<Import Project="$(MSBuildThisFileDirectory)\build\Output.props"/>
|
||||
|
||||
</Project>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<!-- https://github.com/dotnet/sdk/issues/22515-->
|
||||
<ItemGroup>
|
||||
<None Remove="*.csproj.DotSettings" />
|
||||
<None Remove="*.csproj.DotSettings"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,11 +1,11 @@
|
||||
using AtomUI.Demo.Desktop.Views;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using AtomUI.Demo.Desktop.Views;
|
||||
|
||||
namespace AtomUI.Demo.Desktop;
|
||||
|
||||
public partial class App : Application
|
||||
public class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
|
@ -1 +1,43 @@
|
||||
<svg width="130" height="80" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="52.348%" y1="74.611%" x2="52.348%" y2="-17.635%" id="a"><stop stop-color="#DEDEDE" stop-opacity="0" offset="0%"/><stop stop-color="#A9A9A9" stop-opacity=".3" offset="100%"/></linearGradient><linearGradient x1="44.79%" y1="100%" x2="44.79%" y2="0%" id="b"><stop stop-color="#FFF" stop-opacity="0" offset="0%"/><stop stop-color="#96A1C5" stop-opacity=".373" offset="100%"/></linearGradient><linearGradient x1="50%" y1="100%" x2="50%" y2="-19.675%" id="c"><stop stop-color="#FFF" stop-opacity="0" offset="0%"/><stop stop-color="#919191" stop-opacity=".15" offset="100%"/></linearGradient><linearGradient x1="50%" y1="0%" x2="50%" y2="44.95%" id="d"><stop stop-color="#5389F5" offset="0%"/><stop stop-color="#416FDC" offset="100%"/></linearGradient><linearGradient x1="63.345%" y1="100%" x2="63.345%" y2="-5.316%" id="e"><stop stop-color="#DCE9FF" offset="0%"/><stop stop-color="#B6CFFF" offset="100%"/></linearGradient><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="f"><stop stop-color="#7CA5F7" offset="0%"/><stop stop-color="#C4D6FC" offset="100%"/></linearGradient></defs><g transform="translate(-1.866 .364)" fill="none" fill-rule="evenodd"><path d="M27.94 14.864c1.326-4.192 2.56-6.802 3.7-7.831 3.157-2.848 7.522-1.298 8.45-1.076 3.26.782 2.2-4.364 4.997-5.41 1.864-.697 3.397.155 4.6 2.556C50.752.863 52.375-.163 54.556.02c3.272.277 4.417 11.328 8.913 8.909 4.497-2.42 10.01-2.973 12.365.623.509.778.704-.429 4.166-4.55C83.462.88 86.914-.936 93.996 1.464c3.22 1.09 5.868 4.045 7.947 8.864 0 6.878 5.06 10.95 15.178 12.213 15.179 1.895 3.397 18.214-15.178 22.993-18.576 4.78-61.343 7.36-84.551-4.716C1.92 32.769 5.436 24.117 27.939 14.864z" fill="url(#a)" opacity=".8"/><ellipse fill="url(#b)" cx="66" cy="69.166" rx="27.987" ry="6.478"/><path d="M113.25 77.249c-21.043 5.278-92.87-.759-100.515-3.516-3.721-1.343-7.075-3.868-10.061-7.576a2.822 2.822 0 0 1 2.198-4.593h125.514c2.605 6.938-3.107 12.166-17.136 15.685z" fill="url(#c)" opacity=".675"/><g fill-rule="nonzero"><path d="M43.396 12.098L33.825.906a2.434 2.434 0 0 0-1.837-.86h-20.58c-.706 0-1.377.324-1.837.86L0 12.098v6.144h43.396v-6.144z" fill="url(#d)" transform="translate(44.08 39.707)"/><path d="M40.684 18.468L32.307 8.72a2.136 2.136 0 0 0-1.622-.725H12.711c-.617 0-1.22.256-1.622.725l-8.377 9.748v5.354h37.972v-5.354z" fill="url(#e)" transform="translate(44.08 39.707)"/><path d="M43.396 25.283c0 .853-.384 1.62-.99 2.134l-.123.1a2.758 2.758 0 0 1-1.67.56H2.784c-.342 0-.669-.062-.971-.176l-.15-.06A2.802 2.802 0 0 1 0 25.282V12.165h10.529c1.163 0 2.1.957 2.1 2.118v.015c0 1.162.948 2.099 2.111 2.099h13.916a2.113 2.113 0 0 0 2.111-2.107c0-1.166.938-2.125 2.1-2.125h10.53z" fill="url(#f)" transform="translate(44.08 39.707)"/></g></g></svg>
|
||||
<svg width="130" height="80" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient x1="52.348%" y1="74.611%" x2="52.348%" y2="-17.635%" id="a">
|
||||
<stop stop-color="#DEDEDE" stop-opacity="0" offset="0%"/>
|
||||
<stop stop-color="#A9A9A9" stop-opacity=".3" offset="100%"/>
|
||||
</linearGradient>
|
||||
<linearGradient x1="44.79%" y1="100%" x2="44.79%" y2="0%" id="b">
|
||||
<stop stop-color="#FFF" stop-opacity="0" offset="0%"/>
|
||||
<stop stop-color="#96A1C5" stop-opacity=".373" offset="100%"/>
|
||||
</linearGradient>
|
||||
<linearGradient x1="50%" y1="100%" x2="50%" y2="-19.675%" id="c">
|
||||
<stop stop-color="#FFF" stop-opacity="0" offset="0%"/>
|
||||
<stop stop-color="#919191" stop-opacity=".15" offset="100%"/>
|
||||
</linearGradient>
|
||||
<linearGradient x1="50%" y1="0%" x2="50%" y2="44.95%" id="d">
|
||||
<stop stop-color="#5389F5" offset="0%"/>
|
||||
<stop stop-color="#416FDC" offset="100%"/>
|
||||
</linearGradient>
|
||||
<linearGradient x1="63.345%" y1="100%" x2="63.345%" y2="-5.316%" id="e">
|
||||
<stop stop-color="#DCE9FF" offset="0%"/>
|
||||
<stop stop-color="#B6CFFF" offset="100%"/>
|
||||
</linearGradient>
|
||||
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="f">
|
||||
<stop stop-color="#7CA5F7" offset="0%"/>
|
||||
<stop stop-color="#C4D6FC" offset="100%"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g transform="translate(-1.866 .364)" fill="none" fill-rule="evenodd">
|
||||
<path d="M27.94 14.864c1.326-4.192 2.56-6.802 3.7-7.831 3.157-2.848 7.522-1.298 8.45-1.076 3.26.782 2.2-4.364 4.997-5.41 1.864-.697 3.397.155 4.6 2.556C50.752.863 52.375-.163 54.556.02c3.272.277 4.417 11.328 8.913 8.909 4.497-2.42 10.01-2.973 12.365.623.509.778.704-.429 4.166-4.55C83.462.88 86.914-.936 93.996 1.464c3.22 1.09 5.868 4.045 7.947 8.864 0 6.878 5.06 10.95 15.178 12.213 15.179 1.895 3.397 18.214-15.178 22.993-18.576 4.78-61.343 7.36-84.551-4.716C1.92 32.769 5.436 24.117 27.939 14.864z"
|
||||
fill="url(#a)" opacity=".8"/>
|
||||
<ellipse fill="url(#b)" cx="66" cy="69.166" rx="27.987" ry="6.478"/>
|
||||
<path d="M113.25 77.249c-21.043 5.278-92.87-.759-100.515-3.516-3.721-1.343-7.075-3.868-10.061-7.576a2.822 2.822 0 0 1 2.198-4.593h125.514c2.605 6.938-3.107 12.166-17.136 15.685z"
|
||||
fill="url(#c)" opacity=".675"/>
|
||||
<g fill-rule="nonzero">
|
||||
<path d="M43.396 12.098L33.825.906a2.434 2.434 0 0 0-1.837-.86h-20.58c-.706 0-1.377.324-1.837.86L0 12.098v6.144h43.396v-6.144z"
|
||||
fill="url(#d)" transform="translate(44.08 39.707)"/>
|
||||
<path d="M40.684 18.468L32.307 8.72a2.136 2.136 0 0 0-1.622-.725H12.711c-.617 0-1.22.256-1.622.725l-8.377 9.748v5.354h37.972v-5.354z"
|
||||
fill="url(#e)" transform="translate(44.08 39.707)"/>
|
||||
<path d="M43.396 25.283c0 .853-.384 1.62-.99 2.134l-.123.1a2.758 2.758 0 0 1-1.67.56H2.784c-.342 0-.669-.062-.971-.176l-.15-.06A2.802 2.802 0 0 1 0 25.282V12.165h10.529c1.163 0 2.1.957 2.1 2.118v.015c0 1.162.948 2.099 2.111 2.099h13.916a2.113 2.113 0 0 0 2.111-2.107c0-1.166.938-2.125 2.1-2.125h10.53z"
|
||||
fill="url(#f)" transform="translate(44.08 39.707)"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.2 KiB |
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\Build\Output.App.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\Build\Output.App.props"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
@ -9,8 +9,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<TrimmerRootDescriptor Include="Roots.xml" />
|
||||
<AvaloniaResource Include="Assets\**"/>
|
||||
<TrimmerRootDescriptor Include="Roots.xml"/>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -19,19 +19,19 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Nlnet.Avalonia.DevTools" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Avalonia"/>
|
||||
<PackageReference Include="Avalonia.Desktop"/>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent"/>
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid"/>
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics"/>
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Nlnet.Avalonia.DevTools"/>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\AtomUI.Controls\AtomUI.Controls.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Icon.AntDesign\AtomUI.Icon.AntDesign.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Theme\AtomUI.Theme.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Controls\AtomUI.Controls.csproj"/>
|
||||
<ProjectReference Include="..\..\src\AtomUI.Icon.AntDesign\AtomUI.Icon.AntDesign.csproj"/>
|
||||
<ProjectReference Include="..\..\src\AtomUI.Theme\AtomUI.Theme.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,27 +1,30 @@
|
||||
using AtomUI.Controls;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Media;
|
||||
using Separator = AtomUI.Controls.Separator;
|
||||
|
||||
namespace AtomUI.Demo.Desktop;
|
||||
|
||||
public class ShowCaseItem : ContentControl
|
||||
{
|
||||
private bool _initialized = false;
|
||||
private bool _initialized;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
private void SetupUi()
|
||||
{
|
||||
var mainLayout = new StackPanel();
|
||||
var showCaseTitle = new AtomUI.Controls.Separator()
|
||||
var showCaseTitle = new Separator
|
||||
{
|
||||
Title = Title,
|
||||
TitlePosition = AtomUI.Controls.SeparatorTitlePosition.Left,
|
||||
FontWeight = FontWeight.Bold,
|
||||
TitlePosition = SeparatorTitlePosition.Left,
|
||||
FontWeight = FontWeight.Bold
|
||||
};
|
||||
|
||||
if (Content is Control contentControl) {
|
||||
if (Content is Control contentControl)
|
||||
{
|
||||
LogicalChildren.Remove(contentControl);
|
||||
mainLayout.Children.Add(contentControl);
|
||||
}
|
||||
@ -32,14 +35,14 @@ public class ShowCaseItem : ContentControl
|
||||
Background = Brushes.Transparent
|
||||
});
|
||||
mainLayout.Children.Add(showCaseTitle);
|
||||
mainLayout.Children.Add(new TextBlock()
|
||||
mainLayout.Children.Add(new TextBlock
|
||||
{
|
||||
Text = Description,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Margin = new Thickness(0, 10, 0, 0)
|
||||
});
|
||||
|
||||
var outerBorder = new Border()
|
||||
var outerBorder = new Border
|
||||
{
|
||||
BorderBrush = new SolidColorBrush(new Color(10, 5, 5, 5)),
|
||||
BorderThickness = new Thickness(1),
|
||||
@ -53,7 +56,8 @@ public class ShowCaseItem : ContentControl
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
if (!_initialized) {
|
||||
if (!_initialized)
|
||||
{
|
||||
SetupUi();
|
||||
_initialized = true;
|
||||
}
|
||||
|
@ -10,51 +10,48 @@ namespace AtomUI.Demo.Desktop;
|
||||
|
||||
public class ShowCasePanel : Control
|
||||
{
|
||||
public string? Id { get; protected set; }
|
||||
private bool _initialized = false;
|
||||
private bool _initialized;
|
||||
private StackPanel _leftContainer = default!;
|
||||
private StackPanel _rightContainer = default!;
|
||||
|
||||
[Content]
|
||||
public AvaloniaControlList Children { get; } = new AvaloniaControlList();
|
||||
public string? Id { get; protected set; }
|
||||
|
||||
public ShowCasePanel()
|
||||
{
|
||||
}
|
||||
[Content] public AvaloniaControlList Children { get; } = new();
|
||||
|
||||
protected void SetupUi()
|
||||
{
|
||||
var mainLayout = new UniformGrid()
|
||||
var mainLayout = new UniformGrid
|
||||
{
|
||||
Rows = 1,
|
||||
Columns = 2,
|
||||
Margin = new Thickness(0)
|
||||
};
|
||||
_leftContainer = new StackPanel()
|
||||
_leftContainer = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Vertical,
|
||||
Spacing = 10,
|
||||
Margin = new Thickness(0, 0, 10, 0),
|
||||
Margin = new Thickness(0, 0, 10, 0)
|
||||
};
|
||||
_rightContainer = new StackPanel()
|
||||
_rightContainer = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Vertical,
|
||||
Spacing = 10,
|
||||
Spacing = 10
|
||||
};
|
||||
mainLayout.Children.Add(_leftContainer);
|
||||
mainLayout.Children.Add(_rightContainer);
|
||||
|
||||
for (int i = 0; i < Children.Count; ++i) {
|
||||
for (var i = 0; i < Children.Count; ++i)
|
||||
{
|
||||
var control = Children[i];
|
||||
if (i % 2 == 0) {
|
||||
if (i % 2 == 0)
|
||||
_leftContainer.Children.Add(control);
|
||||
} else {
|
||||
else
|
||||
_rightContainer.Children.Add(control);
|
||||
}
|
||||
}
|
||||
var scrollView = new ScrollViewer()
|
||||
|
||||
var scrollView = new ScrollViewer
|
||||
{
|
||||
Content = mainLayout,
|
||||
Content = mainLayout
|
||||
};
|
||||
LogicalChildren.Add(scrollView);
|
||||
VisualChildren.Add(scrollView);
|
||||
@ -62,11 +59,13 @@ public class ShowCasePanel : Control
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
if (!_initialized) {
|
||||
if (!_initialized)
|
||||
{
|
||||
SetupUi();
|
||||
NotifyShowCaseLayoutReady();
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
base.OnAttachedToLogicalTree(e);
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,26 @@
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.Controls;
|
||||
|
||||
public class ColorItemControl : TemplatedControl
|
||||
{
|
||||
public static readonly StyledProperty<string?> ColorNameProperty = AvaloniaProperty.Register<ColorItemControl, string?>(
|
||||
public static readonly StyledProperty<string?> ColorNameProperty =
|
||||
AvaloniaProperty.Register<ColorItemControl, string?>(
|
||||
nameof(ColorName));
|
||||
|
||||
public static readonly StyledProperty<string?> HexProperty = AvaloniaProperty.Register<ColorItemControl, string?>(
|
||||
nameof(Hex));
|
||||
|
||||
public string? ColorName
|
||||
{
|
||||
get => GetValue(ColorNameProperty);
|
||||
set => SetValue(ColorNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string?> HexProperty = AvaloniaProperty.Register<ColorItemControl, string?>(
|
||||
nameof(Hex));
|
||||
|
||||
public string? Hex
|
||||
{
|
||||
get => GetValue(HexProperty);
|
||||
@ -29,10 +30,6 @@ public class ColorItemControl : TemplatedControl
|
||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||
{
|
||||
base.OnPointerPressed(e);
|
||||
if (this.DataContext is ColorItemViewModel v)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(v);
|
||||
}
|
||||
|
||||
if (DataContext is ColorItemViewModel v) WeakReferenceMessenger.Default.Send(v);
|
||||
}
|
||||
}
|
@ -6,7 +6,8 @@ namespace AtomUI.Demo.Desktop.Controls;
|
||||
|
||||
public class ColorListControl : TemplatedControl
|
||||
{
|
||||
public static readonly StyledProperty<ColorListViewModel> ListDataProperty = AvaloniaProperty.Register<ColorListGroupControl, ColorListViewModel>(
|
||||
public static readonly StyledProperty<ColorListViewModel> ListDataProperty =
|
||||
AvaloniaProperty.Register<ColorListGroupControl, ColorListViewModel>(
|
||||
nameof(ListData), new ColorListViewModel());
|
||||
|
||||
public ColorListViewModel ListData
|
||||
|
@ -6,7 +6,8 @@ namespace AtomUI.Demo.Desktop.Controls;
|
||||
|
||||
public class ColorListGroupControl : TemplatedControl
|
||||
{
|
||||
public static readonly StyledProperty<ColorGroupViewModel> GroupDataProperty = AvaloniaProperty.Register<ColorListGroupControl, ColorGroupViewModel>(
|
||||
public static readonly StyledProperty<ColorGroupViewModel> GroupDataProperty =
|
||||
AvaloniaProperty.Register<ColorListGroupControl, ColorGroupViewModel>(
|
||||
nameof(GroupData), new ColorGroupViewModel());
|
||||
|
||||
public ColorGroupViewModel GroupData
|
||||
|
@ -1,26 +1,21 @@
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
using AtomUI.Icon;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
using AtomUI.Icon;
|
||||
using Avalonia.LogicalTree;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.Controls;
|
||||
|
||||
public class IconGallery : TemplatedControl
|
||||
{
|
||||
private bool _initialized = false;
|
||||
private IconGalleryModel _galleryModel;
|
||||
|
||||
public static readonly StyledProperty<IconThemeType?> IconThemeTypeProperty = AvaloniaProperty.Register<IconInfoItem, IconThemeType?>(
|
||||
public static readonly StyledProperty<IconThemeType?> IconThemeTypeProperty =
|
||||
AvaloniaProperty.Register<IconInfoItem, IconThemeType?>(
|
||||
nameof(IconThemeType));
|
||||
|
||||
public IconThemeType? IconThemeType
|
||||
{
|
||||
get => GetValue(IconThemeTypeProperty);
|
||||
set => SetValue(IconThemeTypeProperty, value);
|
||||
}
|
||||
private readonly IconGalleryModel _galleryModel;
|
||||
private bool _initialized;
|
||||
|
||||
public IconGallery()
|
||||
{
|
||||
@ -28,23 +23,25 @@ public class IconGallery : TemplatedControl
|
||||
DataContext = _galleryModel;
|
||||
}
|
||||
|
||||
public IconThemeType? IconThemeType
|
||||
{
|
||||
get => GetValue(IconThemeTypeProperty);
|
||||
set => SetValue(IconThemeTypeProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||
{
|
||||
base.OnPointerPressed(e);
|
||||
if (this.DataContext is ColorItemViewModel v) {
|
||||
WeakReferenceMessenger.Default.Send(v);
|
||||
}
|
||||
if (DataContext is ColorItemViewModel v) WeakReferenceMessenger.Default.Send(v);
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToLogicalTree(e);
|
||||
if (!_initialized) {
|
||||
if (IconThemeType.HasValue) {
|
||||
_galleryModel.LoadThemeIcons(IconThemeType.Value);
|
||||
}
|
||||
if (!_initialized)
|
||||
{
|
||||
if (IconThemeType.HasValue) _galleryModel.LoadThemeIcons(IconThemeType.Value);
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -8,15 +8,15 @@ public class IconInfoItem : TemplatedControl
|
||||
public static readonly StyledProperty<string> IconNameProperty = AvaloniaProperty.Register<IconInfoItem, string>(
|
||||
nameof(IconName));
|
||||
|
||||
public static readonly StyledProperty<string> IconKindProperty = AvaloniaProperty.Register<IconInfoItem, string>(
|
||||
nameof(IconKind));
|
||||
|
||||
public string IconName
|
||||
{
|
||||
get => GetValue(IconNameProperty);
|
||||
set => SetValue(IconNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> IconKindProperty = AvaloniaProperty.Register<IconInfoItem, string>(
|
||||
nameof(IconKind));
|
||||
|
||||
public string IconKind
|
||||
{
|
||||
get => GetValue(IconKindProperty);
|
||||
|
@ -4,20 +4,21 @@ using AtomUI.Theme;
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Avalonia.Media;
|
||||
|
||||
#if DEBUG
|
||||
using Nlnet.Avalonia.DevTools;
|
||||
#endif
|
||||
|
||||
namespace AtomUI.Demo.Desktop;
|
||||
|
||||
class Program
|
||||
internal class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
BuildAvaloniaApp()
|
||||
.With(new FontManagerOptions
|
||||
{
|
||||
FontFallbacks = new[]
|
||||
@ -29,6 +30,7 @@ class Program
|
||||
}
|
||||
})
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
|
||||
@ -15,7 +14,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="More types" Description="There are 4 types of Alert: success, info, warning, error.">
|
||||
<desktop:ShowCaseItem Title="More types"
|
||||
Description="There are 4 types of Alert: success, info, warning, error.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:Alert Type="Success">Success Text</atom:Alert>
|
||||
<atom:Alert Type="Info">Info Text</atom:Alert>
|
||||
@ -29,7 +29,8 @@
|
||||
<atom:Alert IsClosable="True" Type="Warning">
|
||||
Warning Text Warning Text Warning Text Warning Text Warning Text Warning TextWarning Text
|
||||
</atom:Alert>
|
||||
<atom:Alert Description="Error Description Error Description Error Description Error Description Error Description Error Description"
|
||||
<atom:Alert
|
||||
Description="Error Description Error Description Error Description Error Description Error Description Error Description"
|
||||
IsClosable="True"
|
||||
Type="Error">
|
||||
Error Text
|
||||
@ -51,7 +52,8 @@
|
||||
<atom:Alert Description="Info Description Info Description Info Description Info Description"
|
||||
Message="Info Text"
|
||||
Type="Info" />
|
||||
<atom:Alert Description="Warning Description Warning Description Warning Description Warning Description"
|
||||
<atom:Alert
|
||||
Description="Warning Description Warning Description Warning Description Warning Description"
|
||||
Message="Warning Text"
|
||||
Type="Warning" />
|
||||
<atom:Alert Description="Error Description Error Description Error Description Error Description"
|
||||
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.AvatarShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -5,11 +5,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Simplest Usage. Badge will be hidden when count is 0, but we can use showZero to show it.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="Simplest Usage. Badge will be hidden when count is 0, but we can use showZero to show it.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<atom:CountBadge Count="5">
|
||||
<Border Width="40"
|
||||
@ -26,7 +26,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Overflow Count" Description="${overflowCount}+ is displayed when count is larger than overflowCount. The default value of overflowCount is 99.">
|
||||
<desktop:ShowCaseItem Title="Overflow Count"
|
||||
Description="${overflowCount}+ is displayed when count is larger than overflowCount. The default value of overflowCount is 99.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<atom:CountBadge Count="99">
|
||||
<Border Width="40"
|
||||
@ -55,7 +56,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Offset" Description="Set offset of the badge dot, the format is [left, top], which represents the offset of the status dot from the left and top of the default position.">
|
||||
<desktop:ShowCaseItem Title="Offset"
|
||||
Description="Set offset of the badge dot, the format is [left, top], which represents the offset of the status dot from the left and top of the default position.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<atom:CountBadge Count="5" Offset="10, 10">
|
||||
<Border Width="40"
|
||||
@ -118,12 +120,14 @@
|
||||
Background="rgb(191,191,191)"
|
||||
CornerRadius="8" />
|
||||
</atom:DotBadge>
|
||||
<atom:ToggleSwitch VerticalAlignment="Center" IsChecked="{Binding DynamicDotBadgeVisible, Mode=TwoWay}" />
|
||||
<atom:ToggleSwitch VerticalAlignment="Center"
|
||||
IsChecked="{Binding DynamicDotBadgeVisible, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Red badge" Description="This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.">
|
||||
<desktop:ShowCaseItem Title="Red badge"
|
||||
Description="This will simply display a red badge, without a specific count. If count equals 0, it won't display the dot.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:DotBadge Offset="15,9">
|
||||
@ -294,7 +298,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Colorful Badge" Description="We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.">
|
||||
<desktop:ShowCaseItem Title="Colorful Badge"
|
||||
Description="We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:Separator Title="Presets"
|
||||
FontWeight="SemiBold"
|
||||
|
@ -23,6 +23,12 @@ public partial class BadgeShowCase : UserControl
|
||||
public static readonly StyledProperty<double> StandaloneBadgeCount3Property =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount3), 109);
|
||||
|
||||
public BadgeShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public double DynamicBadgeCount
|
||||
{
|
||||
get => GetValue(DynamicBadgeCountProperty);
|
||||
@ -59,12 +65,6 @@ public partial class BadgeShowCase : UserControl
|
||||
set => SetValue(StandaloneBadgeCount3Property, value);
|
||||
}
|
||||
|
||||
public BadgeShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void AddDynamicBadgeCount()
|
||||
{
|
||||
DynamicBadgeCount += 1;
|
||||
@ -87,13 +87,17 @@ public partial class BadgeShowCase : UserControl
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs args)
|
||||
{
|
||||
base.OnPropertyChanged(args);
|
||||
if (args.Property == StandaloneSwitchCheckedProperty) {
|
||||
if (args.Property == StandaloneSwitchCheckedProperty)
|
||||
{
|
||||
var isChecked = args.GetNewValue<bool>();
|
||||
if (isChecked) {
|
||||
if (isChecked)
|
||||
{
|
||||
StandaloneBadgeCount1 = 11;
|
||||
StandaloneBadgeCount2 = 25;
|
||||
StandaloneBadgeCount3 = 109;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
StandaloneBadgeCount1 = 0;
|
||||
StandaloneBadgeCount2 = 0;
|
||||
StandaloneBadgeCount3 = 0;
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCasePanel.Styles>
|
||||
@ -13,7 +12,8 @@
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
||||
</desktop:ShowCasePanel.Styles>
|
||||
<desktop:ShowCaseItem Title="Type" Description="There are primary button, default button, dashed button, text button and link button in antd.">
|
||||
<desktop:ShowCaseItem Title="Type"
|
||||
Description="There are primary button, default button, dashed button, text button and link button in antd.">
|
||||
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<atom:Button ButtonType="Primary">Primary Button</atom:Button>
|
||||
<atom:Button>Default Button</atom:Button>
|
||||
@ -22,7 +22,8 @@
|
||||
</WrapPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Button Shape" Description="Supported button shape display, such as primary, default, dashed and Text, etc.">
|
||||
<desktop:ShowCaseItem Title="Button Shape"
|
||||
Description="Supported button shape display, such as primary, default, dashed and Text, etc.">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<WrapPanel Margin="0,0,0,20"
|
||||
HorizontalAlignment="Left"
|
||||
@ -53,7 +54,8 @@
|
||||
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="AtomUI supports three sizes of buttons: small, default and large. If a large or small button is desired, set the size property to either large or small respectively. Omit the size property for a button with the default size.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="AtomUI supports three sizes of buttons: small, default and large. If a large or small button is desired, set the size property to either large or small respectively. Omit the size property for a button with the default size.">
|
||||
<DockPanel Margin="0,0,0,0">
|
||||
<StackPanel DockPanel.Dock="Top"
|
||||
Orientation="Horizontal"
|
||||
@ -104,7 +106,8 @@
|
||||
</DockPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Icon" Description="You can add an icon through the icon property and adjust the position of the icon using iconPosition.">
|
||||
<desktop:ShowCaseItem Title="Icon"
|
||||
Description="You can add an icon through the icon property and adjust the position of the icon using iconPosition.">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<atom:Button ButtonType="Primary"
|
||||
@ -170,7 +173,8 @@
|
||||
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Loading" Description="A loading indicator can be added to a button by setting the loading property on the Button.">
|
||||
<desktop:ShowCaseItem Title="Loading"
|
||||
Description="A loading indicator can be added to a button by setting the loading property on the Button.">
|
||||
<StackPanel Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
Orientation="Vertical">
|
||||
@ -200,7 +204,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Block Button" Description="block property will make the button fit to its parent width.">
|
||||
<desktop:ShowCaseItem Title="Block Button"
|
||||
Description="block property will make the button fit to its parent width.">
|
||||
<StackPanel Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
Orientation="Vertical">
|
||||
@ -236,7 +241,8 @@
|
||||
</WrapPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Ghost Button" Description="ghost property will make button's background transparent, it is commonly used in colored background.">
|
||||
<desktop:ShowCaseItem Title="Ghost Button"
|
||||
Description="ghost property will make button's background transparent, it is commonly used in colored background.">
|
||||
<Border Margin="10"
|
||||
Padding="10"
|
||||
Background="rgb(190, 200, 200)">
|
||||
@ -292,7 +298,8 @@
|
||||
</Border>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Disabled" Description="To mark a button as disabled, add the disabled property to the Button.">
|
||||
<desktop:ShowCaseItem Title="Disabled"
|
||||
Description="To mark a button as disabled, add the disabled property to the Button.">
|
||||
<WrapPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:Button ButtonType="Primary">
|
||||
|
@ -10,13 +10,7 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
public partial class ButtonShowCase : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<SizeType> ButtonSizeTypeProperty =
|
||||
AvaloniaProperty.Register<ButtonShowCase, SizeType>(nameof(ButtonSizeType), SizeType.Large);
|
||||
|
||||
public SizeType ButtonSizeType
|
||||
{
|
||||
get => GetValue(ButtonSizeTypeProperty);
|
||||
set => SetValue(ButtonSizeTypeProperty, value);
|
||||
}
|
||||
AvaloniaProperty.Register<ButtonShowCase, SizeType>(nameof(ButtonSizeType));
|
||||
|
||||
public ButtonShowCase()
|
||||
{
|
||||
@ -29,20 +23,26 @@ public partial class ButtonShowCase : UserControl
|
||||
LoadingBtn3.Click += HandleLoadingBtnClick;
|
||||
}
|
||||
|
||||
public SizeType ButtonSizeType
|
||||
{
|
||||
get => GetValue(ButtonSizeTypeProperty);
|
||||
set => SetValue(ButtonSizeTypeProperty, value);
|
||||
}
|
||||
|
||||
private void HandleButtonSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
ButtonSizeType = SizeType.Large;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
ButtonSizeType = SizeType.Middle;
|
||||
} else {
|
||||
else
|
||||
ButtonSizeType = SizeType.Small;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleLoadingBtnClick(object? sender, RoutedEventArgs args)
|
||||
{
|
||||
if (sender is Button button) {
|
||||
if (sender is Button button)
|
||||
{
|
||||
button.IsLoading = true;
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Basic button spinner.">
|
||||
@ -16,7 +15,8 @@
|
||||
</atom:ButtonSpinner>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input" Description="There are three sizes of an button spinner: large (40px), default (32px) and small (24px).">
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input"
|
||||
Description="There are three sizes of an button spinner: large (40px), default (32px) and small (24px).">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -130,7 +130,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status" Description="Add status to Input with status, which could be error or warning.">
|
||||
<desktop:ShowCaseItem Title="Status"
|
||||
Description="Add status to Input with status, which could be error or warning.">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
|
@ -4,6 +4,14 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
public partial class ButtonSpinnerShowCase : UserControl
|
||||
{
|
||||
private readonly string[] _spinnerItems =
|
||||
{
|
||||
"床前明月光",
|
||||
"疑是地上霜",
|
||||
"举头望明月",
|
||||
"低头思故乡"
|
||||
};
|
||||
|
||||
public ButtonSpinnerShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -15,28 +23,16 @@ public partial class ButtonSpinnerShowCase : UserControl
|
||||
|
||||
if (spinner.Content is TextBlock textBlock)
|
||||
{
|
||||
int value = Array.IndexOf(_spinnerItems, textBlock.Text);
|
||||
if (e.Direction == SpinDirection.Increase) {
|
||||
var value = Array.IndexOf(_spinnerItems, textBlock.Text);
|
||||
if (e.Direction == SpinDirection.Increase)
|
||||
value++;
|
||||
} else {
|
||||
else
|
||||
value--;
|
||||
}
|
||||
|
||||
if (value < 0) {
|
||||
if (value < 0)
|
||||
value = _spinnerItems.Length - 1;
|
||||
} else if (value >= _spinnerItems.Length) {
|
||||
value = 0;
|
||||
}
|
||||
else if (value >= _spinnerItems.Length) value = 0;
|
||||
textBlock.Text = _spinnerItems[value];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private readonly string[] _spinnerItems = new[]
|
||||
{
|
||||
"床前明月光",
|
||||
"疑是地上霜",
|
||||
"举头望明月",
|
||||
"低头思故乡"
|
||||
};
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.CardShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCasePanel.Styles>
|
||||
@ -79,7 +78,8 @@
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
|
||||
<desktop:ShowCaseItem Title="Check all" Description="The indeterminate property can help you to achieve a 'check all' effect.">
|
||||
<desktop:ShowCaseItem Title="Check all"
|
||||
Description="The indeterminate property can help you to achieve a 'check all' effect.">
|
||||
<StackPanel HorizontalAlignment="Left"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -111,7 +111,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Use with Grid" Description="We can use Checkbox and Grid in Checkbox.Group, to implement complex layout.">
|
||||
<desktop:ShowCaseItem Title="Use with Grid"
|
||||
Description="We can use Checkbox and Grid in Checkbox.Group, to implement complex layout.">
|
||||
<Grid Margin="10"
|
||||
ColumnDefinitions="*,*,*"
|
||||
RowDefinitions="Auto,Auto,Auto">
|
||||
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Collapse" Description="By default, any number of panels can be expanded at a time. The first panel is expanded in this example.">
|
||||
<desktop:ShowCaseItem Title="Collapse"
|
||||
Description="By default, any number of panels can be expanded at a time. The first panel is expanded in this example.">
|
||||
<atom:Collapse>
|
||||
<atom:CollapseItem Header="This is panel header 1">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
@ -28,7 +28,8 @@
|
||||
</atom:Collapse>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="Ant Design supports a default collapse size as well as a large and small size. If a large or small collapse is desired, set the size property to either large or small respectively. Omit the size property for a collapse with the default size.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="Ant Design supports a default collapse size as well as a large and small size. If a large or small collapse is desired, set the size property to either large or small respectively. Omit the size property for a collapse with the default size.">
|
||||
<StackPanel Margin="0,0,10,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="20">
|
||||
@ -65,7 +66,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Accordion" Description="In accordion mode, only one panel can be expanded at a time.">
|
||||
<desktop:ShowCaseItem Title="Accordion"
|
||||
Description="In accordion mode, only one panel can be expanded at a time.">
|
||||
<atom:Collapse IsAccordion="True">
|
||||
<atom:CollapseItem Header="This is panel header 1">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
@ -155,17 +157,20 @@
|
||||
Description="Render extra element in the top-right corner of each panel.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:Collapse ExpandIconPosition="{Binding CollapseExpandIconPosition}">
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}" Header="This is panel header 1">
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}"
|
||||
Header="This is panel header 1">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
|
||||
</TextBlock>
|
||||
</atom:CollapseItem>
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}" Header="This is panel header 2">
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}"
|
||||
Header="This is panel header 2">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
|
||||
</TextBlock>
|
||||
</atom:CollapseItem>
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}" Header="This is panel header 3">
|
||||
<atom:CollapseItem AddOnContent="{atom:IconProvider Kind=SettingOutlined}"
|
||||
Header="This is panel header 3">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
|
||||
</TextBlock>
|
||||
|
@ -7,7 +7,15 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
public partial class CollapseShowCase : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<CollapseExpandIconPosition> CollapseExpandIconPositionProperty =
|
||||
AvaloniaProperty.Register<CollapseShowCase, CollapseExpandIconPosition>(nameof(CollapseExpandIconPosition), CollapseExpandIconPosition.Start);
|
||||
AvaloniaProperty.Register<CollapseShowCase, CollapseExpandIconPosition>(nameof(CollapseExpandIconPosition));
|
||||
|
||||
public CollapseShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
|
||||
//ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
|
||||
}
|
||||
|
||||
public CollapseExpandIconPosition CollapseExpandIconPosition
|
||||
{
|
||||
@ -15,19 +23,10 @@ public partial class CollapseShowCase : UserControl
|
||||
set => SetValue(CollapseExpandIconPositionProperty, value);
|
||||
}
|
||||
|
||||
public CollapseShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
//ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
|
||||
}
|
||||
|
||||
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
CollapseExpandIconPosition = CollapseExpandIconPosition.Start;
|
||||
} else if (args.Index == 1) {
|
||||
CollapseExpandIconPosition = CollapseExpandIconPosition.End;
|
||||
}
|
||||
else if (args.Index == 1) CollapseExpandIconPosition = CollapseExpandIconPosition.End;
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Basic button spinner.">
|
||||
@ -19,7 +18,8 @@
|
||||
</desktop:ShowCaseItem>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input" Description="There are three sizes of an ComboBox: large (40px), default (32px) and small (24px).">
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input"
|
||||
Description="There are three sizes of an ComboBox: large (40px), default (32px) and small (24px).">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -148,7 +148,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status" Description="Add status to Input with status, which could be error or warning.">
|
||||
<desktop:ShowCaseItem Title="Status"
|
||||
Description="Add status to Input with status, which could be error or warning.">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.DatePickerShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
xmlns:utils="clr-namespace:AtomUI.Demo.Desktop.Utils"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@ -51,7 +50,8 @@
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Basic drawer.">
|
||||
<Panel>
|
||||
<atom:ToggleSwitch x:Name="OpenButton01" Content="Open" />
|
||||
<atom:Drawer IsOpen="{Binding $parent[Panel].((atom:ToggleSwitch)Children[0]).IsChecked}" OpenOn="{Binding $parent[TopLevel]}">
|
||||
<atom:Drawer IsOpen="{Binding $parent[Panel].((atom:ToggleSwitch)Children[0]).IsChecked}"
|
||||
OpenOn="{Binding $parent[TopLevel]}">
|
||||
<TextBlock Margin="50" Text="Some contents..." />
|
||||
</atom:Drawer>
|
||||
</Panel>
|
||||
@ -66,7 +66,8 @@
|
||||
<atom:ToggleSwitch Content="Open" />
|
||||
</StackPanel>
|
||||
|
||||
<atom:Drawer IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
<atom:Drawer
|
||||
IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
OpenOn="{Binding $parent[TopLevel]}"
|
||||
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
|
||||
<TextBlock Margin="50" Text="Some contents..." />
|
||||
@ -74,7 +75,8 @@
|
||||
</Panel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Extra Actions" Description="Extra actions should be placed at corner of drawer in Ant Design, you can use extra prop for that.">
|
||||
<desktop:ShowCaseItem Title="Extra Actions"
|
||||
Description="Extra actions should be placed at corner of drawer in Ant Design, you can use extra prop for that.">
|
||||
<Panel>
|
||||
<StackPanel Classes="ControllerPanel">
|
||||
<ListBox Classes="PlacementList"
|
||||
@ -83,7 +85,8 @@
|
||||
<atom:ToggleSwitch Content="Open" />
|
||||
</StackPanel>
|
||||
|
||||
<atom:Drawer IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
<atom:Drawer
|
||||
IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
OpenOn="{Binding $parent[TopLevel]}"
|
||||
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
|
||||
<TextBlock Margin="50" Text=" TODO " />
|
||||
@ -102,7 +105,8 @@
|
||||
<atom:ToggleSwitch Content="Open" />
|
||||
</StackPanel>
|
||||
|
||||
<atom:Drawer IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
<atom:Drawer
|
||||
IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
|
||||
OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
|
||||
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
|
||||
<TextBlock Margin="50" Text=" Some contents... " />
|
||||
|
@ -15,15 +15,9 @@ public partial class DrawerShowCase : UserControl
|
||||
|
||||
private void Button_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not Button button)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (sender is not Button button) return;
|
||||
|
||||
if (Drawer.GetDrawer(button) is not { } drawer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Drawer.GetDrawer(button) is not { } drawer) return;
|
||||
|
||||
drawer.IsOpen = false;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The most basic dropdown menu.">
|
||||
|
@ -5,14 +5,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Simplest Usage.">
|
||||
<atom:EmptyIndicator PresetImage="Default" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="AtomUI supports three sizes of buttons: small, default and large.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="AtomUI supports three sizes of buttons: small, default and large.">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:EmptyIndicator PresetImage="Simple" SizeType="Small" />
|
||||
@ -22,7 +22,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Customize" Description="Customize image source, image size, description and extra content.">
|
||||
<desktop:ShowCaseItem Title="Customize"
|
||||
Description="Customize image source, image size, description and extra content.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:EmptyIndicator Description="Customize Description"
|
||||
ImagePath="avares://AtomUI.Demo.Desktop/Assets/EmptyShowCase/empty.svg"
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Expander" Description="By default, The simplest usage is to expand downward.">
|
||||
@ -16,7 +15,8 @@
|
||||
</atom:Expander>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="Ant Design supports a default Expander size as well as a large and small size. If a large or small Expander is desired, set the size property to either large or small respectively. Omit the size property for a Expander with the default size.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="Ant Design supports a default Expander size as well as a large and small size. If a large or small Expander is desired, set the size property to either large or small respectively. Omit the size property for a Expander with the default size.">
|
||||
<StackPanel Margin="0,0,10,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="20">
|
||||
@ -47,7 +47,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Expanding Direction" Description="The content area supports expansion in four directions.">
|
||||
<desktop:ShowCaseItem Title="Expanding Direction"
|
||||
Description="The content area supports expansion in four directions.">
|
||||
<DockPanel Height="300" Margin="0,0,0,0">
|
||||
<StackPanel DockPanel.Dock="Top"
|
||||
Orientation="Horizontal"
|
||||
|
@ -7,22 +7,10 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
public partial class ExpanderShowCase : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<ExpanderIconPosition> ToggleIconPositionProperty =
|
||||
AvaloniaProperty.Register<ExpanderShowCase, ExpanderIconPosition>(nameof(ToggleIconPosition), ExpanderIconPosition.Start);
|
||||
|
||||
public ExpanderIconPosition ToggleIconPosition
|
||||
{
|
||||
get => GetValue(ToggleIconPositionProperty);
|
||||
set => SetValue(ToggleIconPositionProperty, value);
|
||||
}
|
||||
AvaloniaProperty.Register<ExpanderShowCase, ExpanderIconPosition>(nameof(ToggleIconPosition));
|
||||
|
||||
public static readonly StyledProperty<ExpandDirection> ExpandDirectionProperty =
|
||||
AvaloniaProperty.Register<ExpanderShowCase, ExpandDirection>(nameof(ExpandDirection), ExpandDirection.Down);
|
||||
|
||||
public ExpandDirection ExpandDirection
|
||||
{
|
||||
get => GetValue(ExpandDirectionProperty);
|
||||
set => SetValue(ExpandDirectionProperty, value);
|
||||
}
|
||||
AvaloniaProperty.Register<ExpanderShowCase, ExpandDirection>(nameof(ExpandDirection));
|
||||
|
||||
public ExpanderShowCase()
|
||||
{
|
||||
@ -32,25 +20,33 @@ public partial class ExpanderShowCase : UserControl
|
||||
ExpandDirectionOptionGroup.OptionCheckedChanged += HandleExpandDirectionOptionCheckedChanged;
|
||||
}
|
||||
|
||||
public ExpanderIconPosition ToggleIconPosition
|
||||
{
|
||||
get => GetValue(ToggleIconPositionProperty);
|
||||
set => SetValue(ToggleIconPositionProperty, value);
|
||||
}
|
||||
|
||||
public ExpandDirection ExpandDirection
|
||||
{
|
||||
get => GetValue(ExpandDirectionProperty);
|
||||
set => SetValue(ExpandDirectionProperty, value);
|
||||
}
|
||||
|
||||
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
ToggleIconPosition = ExpanderIconPosition.Start;
|
||||
} else if (args.Index == 1) {
|
||||
ToggleIconPosition = ExpanderIconPosition.End;
|
||||
}
|
||||
else if (args.Index == 1) ToggleIconPosition = ExpanderIconPosition.End;
|
||||
}
|
||||
|
||||
private void HandleExpandDirectionOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
ExpandDirection = ExpandDirection.Down;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
ExpandDirection = ExpandDirection.Up;
|
||||
} else if (args.Index == 2) {
|
||||
else if (args.Index == 2)
|
||||
ExpandDirection = ExpandDirection.Left;
|
||||
} else if (args.Index == 3) {
|
||||
ExpandDirection = ExpandDirection.Right;
|
||||
}
|
||||
else if (args.Index == 3) ExpandDirection = ExpandDirection.Right;
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Basic usage of the GroupBox control.">
|
||||
@ -18,7 +17,8 @@
|
||||
</atom:GroupBox>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Header title Position" Description="GroupBox Header supports three position types: Left, Center and Right.">
|
||||
<desktop:ShowCaseItem Title="Header title Position"
|
||||
Description="GroupBox Header supports three position types: Left, Center and Right.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:GroupBox HeaderTitle="Title Info">
|
||||
<Panel Height="40">
|
||||
@ -44,7 +44,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Header title style" Description="GroupBox Header supports customizing some properties of color and font.">
|
||||
<desktop:ShowCaseItem Title="Header title style"
|
||||
Description="GroupBox Header supports customizing some properties of color and font.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:GroupBox HeaderFontStyle="Italic" HeaderTitle="Title Info">
|
||||
<Panel Height="40">
|
||||
|
@ -1,7 +1,7 @@
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Threading;
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
@ -15,11 +15,8 @@ public partial class IconShowCase : UserControl
|
||||
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
PaletteDemoViewModel vm = new PaletteDemoViewModel();
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
vm.InitializeResources();
|
||||
});
|
||||
var vm = new PaletteDemoViewModel();
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { vm.InitializeResources(); });
|
||||
DataContext = vm;
|
||||
}
|
||||
}
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The most basic example. The size of the floating layer depends on the contents region.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="The most basic example. The size of the floating layer depends on the contents region.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:FlyoutHost Trigger="Hover">
|
||||
<atom:FlyoutHost.Flyout>
|
||||
|
@ -10,9 +10,35 @@ public partial class InfoFlyoutShowCase : UserControl
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
|
||||
|
||||
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter), false);
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter));
|
||||
|
||||
private Segmented _segmented;
|
||||
private readonly Segmented _segmented;
|
||||
|
||||
public InfoFlyoutShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
var control = this as Control;
|
||||
_segmented = control.FindControl<Segmented>("ArrowSegmented")!;
|
||||
_segmented.SelectionChanged += (sender, args) =>
|
||||
{
|
||||
if (_segmented.SelectedIndex == 0)
|
||||
{
|
||||
ShowArrow = true;
|
||||
IsPointAtCenter = false;
|
||||
}
|
||||
else if (_segmented.SelectedIndex == 1)
|
||||
{
|
||||
ShowArrow = false;
|
||||
IsPointAtCenter = false;
|
||||
}
|
||||
else if (_segmented.SelectedIndex == 2)
|
||||
{
|
||||
IsPointAtCenter = true;
|
||||
ShowArrow = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public bool ShowArrow
|
||||
{
|
||||
@ -25,25 +51,4 @@ public partial class InfoFlyoutShowCase : UserControl
|
||||
get => GetValue(IsPointAtCenterProperty);
|
||||
set => SetValue(IsPointAtCenterProperty, value);
|
||||
}
|
||||
|
||||
public InfoFlyoutShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
var control = this as Control;
|
||||
_segmented = control.FindControl<Segmented>("ArrowSegmented")!;
|
||||
_segmented.SelectionChanged += (sender, args) =>
|
||||
{
|
||||
if (_segmented.SelectedIndex == 0) {
|
||||
ShowArrow = true;
|
||||
IsPointAtCenter = false;
|
||||
} else if (_segmented.SelectedIndex == 1) {
|
||||
ShowArrow = false;
|
||||
IsPointAtCenter = false;
|
||||
} else if (_segmented.SelectedIndex == 2) {
|
||||
IsPointAtCenter = true;
|
||||
ShowArrow = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -5,14 +5,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic usage" Description="Basic usage example.">
|
||||
<atom:LineEdit Watermark="Basic usage" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input" Description="There are three sizes of an Input box: large (40px), default (32px) and small (24px).">
|
||||
<desktop:ShowCaseItem Title="Three sizes of Input"
|
||||
Description="There are three sizes of an Input box: large (40px), default (32px) and small (24px).">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -55,7 +55,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="With clear icon" Description="Input box with the remove icon, click the icon to delete everything.">
|
||||
<desktop:ShowCaseItem Title="With clear icon"
|
||||
Description="Input box with the remove icon, click the icon to delete everything.">
|
||||
<atom:LineEdit Width="400"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnableClearButton="True"
|
||||
@ -82,7 +83,8 @@
|
||||
|
||||
<desktop:ShowCaseItem Title="prefix and suffix" Description="Add a prefix or suffix icons inside input.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:LineEdit InnerLeftContent="{atom:IconProvider Kind=UserOutlined,
|
||||
<atom:LineEdit
|
||||
InnerLeftContent="{atom:IconProvider Kind=UserOutlined,
|
||||
NormalFilledColor=#D7D7D7}"
|
||||
InnerRightContent="{atom:IconProvider Kind=InfoCircleOutlined,
|
||||
NormalFilledColor=#8C8C8C}"
|
||||
@ -94,7 +96,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status" Description="Add status to Input with status, which could be error or warning.">
|
||||
<desktop:ShowCaseItem Title="Status"
|
||||
Description="Add status to Input with status, which could be error or warning.">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -127,7 +130,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Search box" Description="Example of creating a search box by grouping a standard input with a search button.">
|
||||
<desktop:ShowCaseItem Title="Search box"
|
||||
Description="Example of creating a search box by grouping a standard input with a search button.">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
|
@ -8,5 +8,4 @@ public partial class LineEditShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic usage" Description="Basic usage example.">
|
||||
|
@ -5,14 +5,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic Usage" Description="A simple loading status.">
|
||||
<atom:LoadingIndicator />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="A small LoadingIndicator is used for loading text, default sized LoadingIndicator for loading a card-level block, and large LoadingIndicator used for loading a page.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="A small LoadingIndicator is used for loading text, default sized LoadingIndicator for loading a card-level block, and large LoadingIndicator used for loading a page.">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:LoadingIndicator VerticalAlignment="Center" SizeType="Small" />
|
||||
<atom:LoadingIndicator VerticalAlignment="Center" SizeType="Middle" />
|
||||
|
@ -6,13 +6,7 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
public partial class LoadingIndicatorShowCase : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<bool> IsLoadingSwitchCheckedProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(IsLoadingSwitchChecked), false);
|
||||
|
||||
public bool IsLoadingSwitchChecked
|
||||
{
|
||||
get => GetValue(IsLoadingSwitchCheckedProperty);
|
||||
set => SetValue(IsLoadingSwitchCheckedProperty, value);
|
||||
}
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(IsLoadingSwitchChecked));
|
||||
|
||||
public LoadingIndicatorShowCase()
|
||||
{
|
||||
@ -20,4 +14,9 @@ public partial class LoadingIndicatorShowCase : UserControl
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool IsLoadingSwitchChecked
|
||||
{
|
||||
get => GetValue(IsLoadingSwitchCheckedProperty);
|
||||
set => SetValue(IsLoadingSwitchCheckedProperty, value);
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Simplest Usage.">
|
||||
@ -59,7 +58,8 @@
|
||||
</atom:Menu>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="menu item with ToggleType" Description="Renders a checkbox or radio button on a menu.">
|
||||
<desktop:ShowCaseItem Title="menu item with ToggleType"
|
||||
Description="Renders a checkbox or radio button on a menu.">
|
||||
<atom:Menu>
|
||||
<atom:MenuItem Header="_Menu A">
|
||||
<atom:MenuItem GroupName="Group1"
|
||||
@ -93,7 +93,8 @@
|
||||
</atom:Menu>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Scrollable menu" Description="When there are too many menu items, up and down scroll buttons will appear.">
|
||||
<desktop:ShowCaseItem Title="Scrollable menu"
|
||||
Description="When there are too many menu items, up and down scroll buttons will appear.">
|
||||
<atom:Menu>
|
||||
<atom:MenuItem Header="_Menu">
|
||||
<atom:MenuItem Header="Menu Item" />
|
||||
|
@ -8,5 +8,4 @@ public partial class MenuShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The simplest usage for Message.">
|
||||
@ -14,7 +13,8 @@
|
||||
</atom:Button>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Other types of message" Description="Messages of success, error and warning types.">
|
||||
<desktop:ShowCaseItem Title="Other types of message"
|
||||
Description="Messages of success, error and warning types.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:Button ButtonType="Default" Click="ShowSuccessMessage">
|
||||
Success
|
||||
@ -31,13 +31,15 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Message with loading indicator" Description="Display a global loading indicator, which is dismissed by itself asynchronously.">
|
||||
<desktop:ShowCaseItem Title="Message with loading indicator"
|
||||
Description="Display a global loading indicator, which is dismissed by itself asynchronously.">
|
||||
<atom:Button ButtonType="Default" Click="ShowLoadingMessage">
|
||||
Display a loading indicator
|
||||
</atom:Button>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Callback" Description="The above example will display a new message when the old message is about to close.">
|
||||
<desktop:ShowCaseItem Title="Callback"
|
||||
Description="The above example will display a new message when the old message is about to close.">
|
||||
<atom:Button ButtonType="Default" Click="ShowSequentialMessage">
|
||||
Display a loading indicator
|
||||
</atom:Button>
|
||||
|
@ -27,7 +27,7 @@ public partial class MessageShowCase : UserControl
|
||||
private void ShowSimpleMessage(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_messageManager?.Show(new Message(
|
||||
content: "Hello, AtomUI/Avalonia!"
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The simplest usage for Notification.">
|
||||
@ -14,13 +13,15 @@
|
||||
</atom:Button>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Duration after which the notification box is closed" Description="Duration can be used to specify how long the notification stays open. After the duration time elapses, the notification closes automatically. If not specified, default value is 4.5 seconds. If you set the value to TimeSpan.Zero, the notification box will never close automatically.">
|
||||
<desktop:ShowCaseItem Title="Duration after which the notification box is closed"
|
||||
Description="Duration can be used to specify how long the notification stays open. After the duration time elapses, the notification closes automatically. If not specified, default value is 4.5 seconds. If you set the value to TimeSpan.Zero, the notification box will never close automatically.">
|
||||
<atom:Button ButtonType="Primary" Click="ShowNeverCloseNotification">
|
||||
Open the notification box
|
||||
</atom:Button>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Notification with icon" Description="A notification box with a icon at the left side.">
|
||||
<desktop:ShowCaseItem Title="Notification with icon"
|
||||
Description="A notification box with a icon at the left side.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:Button ButtonType="Default" Click="ShowSuccessNotification">
|
||||
Success
|
||||
@ -37,7 +38,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Placement" Description="A notification box can appear from the top bottom topLeft topRight bottomLeft or bottomRight of the viewport via placement.">
|
||||
<desktop:ShowCaseItem Title="Placement"
|
||||
Description="A notification box can appear from the top bottom topLeft topRight bottomLeft or bottomRight of the viewport via placement.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:Button ButtonType="Primary" Click="ShowTopNotification">
|
||||
|
@ -9,13 +9,13 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
public partial class NotificationShowCase : UserControl
|
||||
{
|
||||
private WindowNotificationManager? _basicManager;
|
||||
private WindowNotificationManager? _topLeftManager;
|
||||
private WindowNotificationManager? _topManager;
|
||||
private WindowNotificationManager? _topRightManager;
|
||||
|
||||
private WindowNotificationManager? _bottomLeftManager;
|
||||
private WindowNotificationManager? _bottomManager;
|
||||
private WindowNotificationManager? _bottomRightManager;
|
||||
private WindowNotificationManager? _topLeftManager;
|
||||
private WindowNotificationManager? _topManager;
|
||||
private WindowNotificationManager? _topRightManager;
|
||||
|
||||
public NotificationShowCase()
|
||||
{
|
||||
@ -25,14 +25,14 @@ public partial class NotificationShowCase : UserControl
|
||||
|
||||
private void HandleHoverOptionGroupCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (_basicManager is not null) {
|
||||
if (args.Index == 0) {
|
||||
if (_basicManager is not null)
|
||||
{
|
||||
if (args.Index == 0)
|
||||
_basicManager.IsPauseOnHover = true;
|
||||
} else {
|
||||
else
|
||||
_basicManager.IsPauseOnHover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
@ -83,17 +83,18 @@ public partial class NotificationShowCase : UserControl
|
||||
private void ShowSimpleNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_basicManager?.Show(new Notification(
|
||||
title: "Notification Title",
|
||||
content: "Hello, AtomUI/Avalonia!"
|
||||
"Notification Title",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowNeverCloseNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_basicManager?.Show(new Notification(
|
||||
expiration : TimeSpan.Zero,
|
||||
title : "Notification Title",
|
||||
content : "I will never close automatically. This is a purposely very very long description that has many many characters and words."
|
||||
expiration: TimeSpan.Zero,
|
||||
title: "Notification Title",
|
||||
content:
|
||||
"I will never close automatically. This is a purposely very very long description that has many many characters and words."
|
||||
));
|
||||
}
|
||||
|
||||
@ -102,7 +103,8 @@ public partial class NotificationShowCase : UserControl
|
||||
_basicManager?.Show(new Notification(
|
||||
type: NotificationType.Success,
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
content:
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
));
|
||||
}
|
||||
|
||||
@ -111,7 +113,8 @@ public partial class NotificationShowCase : UserControl
|
||||
_basicManager?.Show(new Notification(
|
||||
type: NotificationType.Information,
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
content:
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
));
|
||||
}
|
||||
|
||||
@ -120,7 +123,8 @@ public partial class NotificationShowCase : UserControl
|
||||
_basicManager?.Show(new Notification(
|
||||
type: NotificationType.Warning,
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
content:
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
));
|
||||
}
|
||||
|
||||
@ -129,65 +133,65 @@ public partial class NotificationShowCase : UserControl
|
||||
_basicManager?.Show(new Notification(
|
||||
type: NotificationType.Error,
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
content:
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification."
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowTopNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_topManager?.Show(new Notification(
|
||||
title : "Notification Top",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification Top",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowBottomNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_bottomManager?.Show(new Notification(
|
||||
title : "Notification Bottom",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification Bottom",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowTopLeftNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_topLeftManager?.Show(new Notification(
|
||||
title : "Notification TopLeft",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification TopLeft",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowTopRightNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_topRightManager?.Show(new Notification(
|
||||
title : "Notification TopRight",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification TopRight",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowBottomLeftNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_bottomLeftManager?.Show(new Notification(
|
||||
title : "Notification BottomLeft",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification BottomLeft",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
private void ShowBottomRightNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_bottomRightManager?.Show(new Notification(
|
||||
title : "Notification BottomRight",
|
||||
content : "Hello, AtomUI/Avalonia!"
|
||||
"Notification BottomRight",
|
||||
"Hello, AtomUI/Avalonia!"
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
private void ShowCustomIconNotification(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_basicManager?.Show(new Notification(
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification.",
|
||||
icon: new PathIcon()
|
||||
"Notification Title",
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification.",
|
||||
icon: new PathIcon
|
||||
{
|
||||
Kind = "SettingOutlined"
|
||||
}
|
||||
@ -199,8 +203,9 @@ public partial class NotificationShowCase : UserControl
|
||||
_basicManager?.Show(new Notification(
|
||||
type: NotificationType.Information,
|
||||
title: "Notification Title",
|
||||
content: "This is the content of the notification. This is the content of the notification. This is the content of the notification.",
|
||||
showProgress:true
|
||||
content:
|
||||
"This is the content of the notification. This is the content of the notification. This is the content of the notification.",
|
||||
showProgress: true
|
||||
));
|
||||
}
|
||||
}
|
@ -5,14 +5,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic usage" Description="Numeric-only NumberUpDown.">
|
||||
<atom:NumericUpDown Value="3" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three sizes of NumberUpDown" Description="There are three sizes of an Input box: large (40px), default (32px) and small (24px).">
|
||||
<desktop:ShowCaseItem Title="Three sizes of NumberUpDown"
|
||||
Description="There are three sizes of an Input box: large (40px), default (32px) and small (24px).">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
@ -49,7 +49,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="With clear icon" Description="Input box with the remove icon, click the icon to delete everything.">
|
||||
<desktop:ShowCaseItem Title="With clear icon"
|
||||
Description="Input box with the remove icon, click the icon to delete everything.">
|
||||
<atom:NumericUpDown Width="400"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnableClearButton="True"
|
||||
@ -58,7 +59,8 @@
|
||||
|
||||
<desktop:ShowCaseItem Title="prefix and suffix" Description="Add a prefix or suffix icons inside input.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:NumericUpDown InnerLeftContent="{atom:IconProvider Kind=UserOutlined,
|
||||
<atom:NumericUpDown
|
||||
InnerLeftContent="{atom:IconProvider Kind=UserOutlined,
|
||||
NormalFilledColor=#D7D7D7}"
|
||||
InnerRightContent="{atom:IconProvider Kind=InfoCircleOutlined,
|
||||
NormalFilledColor=#8C8C8C}"
|
||||
@ -70,7 +72,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status" Description="Add status to Input with status, which could be error or warning.">
|
||||
<desktop:ShowCaseItem Title="Status"
|
||||
Description="Add status to Input with status, which could be error or warning.">
|
||||
<StackPanel Margin="0,0,20,0"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
|
@ -8,5 +8,4 @@ public partial class NumberUpDownShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -3,14 +3,12 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Avalonia.Markup.Xaml.Converters;assembly=Avalonia.Markup.Xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="1000"
|
||||
d:DesignWidth="1920"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Styles>
|
||||
|
@ -12,32 +12,32 @@ public partial class Overview : UserControl
|
||||
public string MainInstall { get; set; } = "dotnet add package AtomUI --version 11.0.7";
|
||||
|
||||
public string MainStyle { get; set; } = """
|
||||
<Application.Styles>
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://AtomUI/Themes/Index.axaml" />
|
||||
</Application.Styles>
|
||||
""";
|
||||
</Application.Styles>
|
||||
""";
|
||||
|
||||
public string ColorPickerInstall { get; set; } = "dotnet add package AtomUI.ColorPicker --version 11.0.7";
|
||||
|
||||
public string ColorPickerStyle { get; set; } = """
|
||||
<Application.Styles>
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://AtomUI.ColorPicker/Index.axaml" />
|
||||
</Application.Styles>
|
||||
""";
|
||||
</Application.Styles>
|
||||
""";
|
||||
|
||||
public string DataGridInstall { get; set; } = "dotnet add package AtomUI.DataGrid --version 11.0.7";
|
||||
|
||||
public string DataGridStyle { get; set; } = """
|
||||
<Application.Styles>
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://AtomUI.DataGrid/Index.axaml" />
|
||||
</Application.Styles>
|
||||
""";
|
||||
</Application.Styles>
|
||||
""";
|
||||
|
||||
public string TreeDataGridInstall { get; set; } = "dotnet add package AtomUI.TreeDataGrid --version 11.0.7";
|
||||
|
||||
public string TreeDataGridStyle { get; set; } = """
|
||||
<Application.Styles>
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://AtomUI.TreeDataGrid/Index.axaml" />
|
||||
</Application.Styles>
|
||||
""";
|
||||
</Application.Styles>
|
||||
""";
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.PaginationShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -1,7 +1,7 @@
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Threading;
|
||||
using AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
@ -15,11 +15,8 @@ public partial class PaletteShowCase : UserControl
|
||||
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
PaletteDemoViewModel vm = new PaletteDemoViewModel();
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
vm.InitializeResources();
|
||||
});
|
||||
var vm = new PaletteDemoViewModel();
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { vm.InitializeResources(); });
|
||||
DataContext = vm;
|
||||
}
|
||||
}
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic usage" Description="The basic example supports the title and description props of confirmation.">
|
||||
<desktop:ShowCaseItem Title="Basic usage"
|
||||
Description="The basic example supports the title and description props of confirmation.">
|
||||
<atom:PopupConfirm Title="Delete the task"
|
||||
CancelText="Cancel"
|
||||
ConfirmContent="Are you sure to delete this task?"
|
||||
@ -17,7 +17,8 @@
|
||||
</atom:PopupConfirm>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Locale text" Description="Set okText and cancelText props to customize the button's labels.">
|
||||
<desktop:ShowCaseItem Title="Locale text"
|
||||
Description="Set okText and cancelText props to customize the button's labels.">
|
||||
<atom:PopupConfirm Title="Delete the task" ConfirmContent="Are you sure to delete this task?">
|
||||
<atom:Button ButtonType="Default" IsDanger="True">Delete</atom:Button>
|
||||
</atom:PopupConfirm>
|
||||
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCasePanel.Styles>
|
||||
@ -118,7 +117,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Custom text format" Description="You can set a custom text by setting the format prop.">
|
||||
<desktop:ShowCaseItem Title="Custom text format"
|
||||
Description="You can set a custom text by setting the format prop.">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<atom:CircleProgress Maximum="100"
|
||||
Minimum="0"
|
||||
@ -130,7 +130,8 @@
|
||||
</WrapPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Dashboard" Description="By setting type=dashboard, you can get a dashboard style of progress easily. Modify gapDegree to set the degree of gap.">
|
||||
<desktop:ShowCaseItem Title="Dashboard"
|
||||
Description="By setting type=dashboard, you can get a dashboard style of progress easily. Modify gapDegree to set the degree of gap.">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<atom:DashboardProgress DashboardGapPosition="Left"
|
||||
Maximum="100"
|
||||
@ -153,7 +154,8 @@
|
||||
</WrapPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Progress bar with success segment" Description="Show several parts of progress with different status.">
|
||||
<desktop:ShowCaseItem Title="Progress bar with success segment"
|
||||
Description="Show several parts of progress with different status.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:ProgressBar Maximum="100"
|
||||
Minimum="0"
|
||||
@ -174,7 +176,8 @@
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
|
||||
<desktop:ShowCaseItem Title="Stroke Linecap" Description="By setting strokeLinecap='butt', you can change the linecaps from round to butt, see stroke-linecap for more information.">
|
||||
<desktop:ShowCaseItem Title="Stroke Linecap"
|
||||
Description="By setting strokeLinecap='butt', you can change the linecaps from round to butt, see stroke-linecap for more information.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:ProgressBar Maximum="100"
|
||||
Minimum="0"
|
||||
@ -193,7 +196,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Custom line gradient" Description="Gradient encapsulation, circle and dashboard will ignore strokeLinecap when setting gradient.">
|
||||
<desktop:ShowCaseItem Title="Custom line gradient"
|
||||
Description="Gradient encapsulation, circle and dashboard will ignore strokeLinecap when setting gradient.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:ProgressBar IndicatorBarBrush="{Binding TwoStopsGradientStrokeColor}"
|
||||
Maximum="100"
|
||||
@ -266,7 +270,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Circular progress bar whit steps" Description="A circular progress bar that support steps and color segments, default gap is 2px.">
|
||||
<desktop:ShowCaseItem Title="Circular progress bar whit steps"
|
||||
Description="A circular progress bar that support steps and color segments, default gap is 2px.">
|
||||
<StackPanel Orientation="Vertical" Spacing="5">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<atom:CircleProgress IndicatorThickness="20"
|
||||
@ -327,7 +332,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Circular progress bar whit steps" Description="A circular progress bar that support steps and color segments, default gap is 2px.">
|
||||
<desktop:ShowCaseItem Title="Circular progress bar whit steps"
|
||||
Description="A circular progress bar that support steps and color segments, default gap is 2px.">
|
||||
<StackPanel x:Name="CircleWithStep"
|
||||
Orientation="Vertical"
|
||||
Spacing="5">
|
||||
@ -424,7 +430,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Change progress value position" Description="Change the position of the progress value, you can use percentPosition to adjust it so that the progress bar value is inside, outside or at the bottom of the progress bar.">
|
||||
<desktop:ShowCaseItem Title="Change progress value position"
|
||||
Description="Change the position of the progress value, you can use percentPosition to adjust it so that the progress bar value is inside, outside or at the bottom of the progress bar.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:ProgressBar Width="300"
|
||||
Maximum="100"
|
||||
@ -472,7 +479,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Change progress value position for StepsProgressBar" Description="Change the position of the progress value, you can use percentPosition to adjust it so that the progress bar value is inside, outside or at the bottom of the progress bar.">
|
||||
<desktop:ShowCaseItem Title="Change progress value position for StepsProgressBar"
|
||||
Description="Change the position of the progress value, you can use percentPosition to adjust it so that the progress bar value is inside, outside or at the bottom of the progress bar.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:StepsProgressBar Maximum="100"
|
||||
Minimum="0"
|
||||
@ -520,7 +528,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar" Description="Ordinary linear progress bar, supports position specification of additional areas">
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar"
|
||||
Description="Ordinary linear progress bar, supports position specification of additional areas">
|
||||
<StackPanel Height="300"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
@ -576,7 +585,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar" Description="Ordinary step progress bar, supports position specification of additional areas">
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar"
|
||||
Description="Ordinary step progress bar, supports position specification of additional areas">
|
||||
<StackPanel Height="300"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
@ -618,7 +628,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar" Description="Ordinary step progress bar, supports position specification of additional areas">
|
||||
<desktop:ShowCaseItem Title="Vertical progress bar"
|
||||
Description="Ordinary step progress bar, supports position specification of additional areas">
|
||||
<StackPanel Height="300"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
@ -660,7 +671,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="toggle disabled status" Description="The progress bar is in the disabled state and uses the disabled style.">
|
||||
<desktop:ShowCaseItem Title="toggle disabled status"
|
||||
Description="The progress bar is in the disabled state and uses the disabled style.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:ProgressBar IsEnabled="{Binding ToggleStatus}"
|
||||
Maximum="100"
|
||||
|
@ -7,6 +7,77 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
public partial class ProgressBarShowCase : UserControl
|
||||
{
|
||||
public static readonly StyledProperty<double> ProgressValueProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(ProgressValue), 30);
|
||||
|
||||
public static readonly StyledProperty<string> ToggleDisabledTextProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, string>(nameof(ToggleDisabledText), "Disable");
|
||||
|
||||
public static readonly StyledProperty<bool> ToggleStatusProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(ToggleStatus), true);
|
||||
|
||||
public ProgressBarShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
|
||||
TwoStopsGradientStrokeColor = new LinearGradientBrush
|
||||
{
|
||||
GradientStops =
|
||||
{
|
||||
new GradientStop(Color.Parse("#108ee9"), 0),
|
||||
new GradientStop(Color.Parse("#87d068"), 1)
|
||||
}
|
||||
};
|
||||
ThreeStopsGradientStrokeColor = new LinearGradientBrush
|
||||
{
|
||||
GradientStops =
|
||||
{
|
||||
new GradientStop(Color.Parse("#87d068"), 0),
|
||||
new GradientStop(Color.Parse("#ffe58f"), 0.5),
|
||||
new GradientStop(Color.Parse("#ffccc7"), 1)
|
||||
}
|
||||
};
|
||||
StepsChunkBrushes = new List<IBrush>
|
||||
{
|
||||
new SolidColorBrush(Colors.Green),
|
||||
new SolidColorBrush(Colors.Green),
|
||||
new SolidColorBrush(Colors.Red)
|
||||
};
|
||||
|
||||
InnerStartPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.Start
|
||||
};
|
||||
InnerCenterPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.Center
|
||||
};
|
||||
InnerEndPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.End
|
||||
};
|
||||
|
||||
OutterStartPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.Start
|
||||
};
|
||||
OutterCenterPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.Center
|
||||
};
|
||||
OutterEndPercentPosition = new PercentPosition
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.End
|
||||
};
|
||||
}
|
||||
|
||||
public LinearGradientBrush TwoStopsGradientStrokeColor { get; set; }
|
||||
|
||||
public LinearGradientBrush ThreeStopsGradientStrokeColor { get; set; }
|
||||
@ -21,15 +92,6 @@ public partial class ProgressBarShowCase : UserControl
|
||||
public PercentPosition OutterCenterPercentPosition { get; set; }
|
||||
public PercentPosition OutterEndPercentPosition { get; set; }
|
||||
|
||||
public static readonly StyledProperty<double> ProgressValueProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(ProgressValue), 30);
|
||||
|
||||
public static readonly StyledProperty<string> ToggleDisabledTextProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, string>(nameof(ToggleDisabledText), "Disable");
|
||||
|
||||
public static readonly StyledProperty<bool> ToggleStatusProperty =
|
||||
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(ToggleStatus), true);
|
||||
|
||||
public double ProgressValue
|
||||
{
|
||||
get => GetValue(ProgressValueProperty);
|
||||
@ -48,68 +110,6 @@ public partial class ProgressBarShowCase : UserControl
|
||||
set => SetValue(ToggleStatusProperty, value);
|
||||
}
|
||||
|
||||
public ProgressBarShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
|
||||
TwoStopsGradientStrokeColor = new LinearGradientBrush()
|
||||
{
|
||||
GradientStops =
|
||||
{
|
||||
new GradientStop(Color.Parse("#108ee9"), 0),
|
||||
new GradientStop(Color.Parse("#87d068"), 1)
|
||||
}
|
||||
};
|
||||
ThreeStopsGradientStrokeColor = new LinearGradientBrush()
|
||||
{
|
||||
GradientStops =
|
||||
{
|
||||
new GradientStop(Color.Parse("#87d068"), 0),
|
||||
new GradientStop(Color.Parse("#ffe58f"), 0.5),
|
||||
new GradientStop(Color.Parse("#ffccc7"), 1)
|
||||
}
|
||||
};
|
||||
StepsChunkBrushes = new List<IBrush>()
|
||||
{
|
||||
new SolidColorBrush(Colors.Green),
|
||||
new SolidColorBrush(Colors.Green),
|
||||
new SolidColorBrush(Colors.Red)
|
||||
};
|
||||
|
||||
InnerStartPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.Start
|
||||
};
|
||||
InnerCenterPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.Center
|
||||
};
|
||||
InnerEndPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = true,
|
||||
Alignment = LinePercentAlignment.End
|
||||
};
|
||||
|
||||
OutterStartPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.Start
|
||||
};
|
||||
OutterCenterPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.Center
|
||||
};
|
||||
OutterEndPercentPosition = new PercentPosition()
|
||||
{
|
||||
IsInner = false,
|
||||
Alignment = LinePercentAlignment.End
|
||||
};
|
||||
}
|
||||
|
||||
public void AddProgressValue()
|
||||
{
|
||||
var value = ProgressValue;
|
||||
@ -127,10 +127,9 @@ public partial class ProgressBarShowCase : UserControl
|
||||
public void ToggleEnabledStatus()
|
||||
{
|
||||
ToggleStatus = !ToggleStatus;
|
||||
if (ToggleStatus) {
|
||||
if (ToggleStatus)
|
||||
ToggleDisabledText = "Disable";
|
||||
} else {
|
||||
else
|
||||
ToggleDisabledText = "Enable";
|
||||
}
|
||||
}
|
||||
}
|
@ -140,7 +140,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size type" Description="There are three sizes available: large, medium, and small. It can coordinate with input box.">
|
||||
<desktop:ShowCaseItem Title="Size type"
|
||||
Description="There are three sizes available: large, medium, and small. It can coordinate with input box.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<atom:OptionButtonGroup SizeType="Large">
|
||||
<atom:OptionButton IsChecked="True">Hangzhou</atom:OptionButton>
|
||||
|
@ -4,11 +4,9 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
public partial class RadioButtonShowCase : UserControl
|
||||
{
|
||||
protected List<string> CheckRadios { get; set; }
|
||||
|
||||
public RadioButtonShowCase()
|
||||
{
|
||||
CheckRadios = new List<string>()
|
||||
CheckRadios = new List<string>
|
||||
{
|
||||
"ToggleDisabledRadioUnChecked",
|
||||
"ToggleDisabledRadioChecked"
|
||||
@ -16,18 +14,16 @@ public partial class RadioButtonShowCase : UserControl
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected List<string> CheckRadios { get; set; }
|
||||
|
||||
public static void ToggleDisabledStatus(object arg)
|
||||
{
|
||||
var btn = (arg as Button)!;
|
||||
var stackPanel = btn.Parent as StackPanel;
|
||||
var radioBtn1 = stackPanel?.FindControl<RadioButton>("ToggleDisabledRadioUnChecked");
|
||||
var radioBtn2 = stackPanel?.FindControl<RadioButton>("ToggleDisabledRadioChecked");
|
||||
if (radioBtn1 != null) {
|
||||
radioBtn1.IsEnabled = !radioBtn1.IsEnabled;
|
||||
}
|
||||
if (radioBtn1 != null) radioBtn1.IsEnabled = !radioBtn1.IsEnabled;
|
||||
|
||||
if (radioBtn2 != null) {
|
||||
radioBtn2.IsEnabled = !radioBtn2.IsEnabled;
|
||||
}
|
||||
if (radioBtn2 != null) radioBtn2.IsEnabled = !radioBtn2.IsEnabled;
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The most basic usage.">
|
||||
@ -22,7 +21,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Block Segmented" Description="block property will make the Segmented fit to its parent width.">
|
||||
<desktop:ShowCaseItem Title="Block Segmented"
|
||||
Description="block property will make the Segmented fit to its parent width.">
|
||||
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||
<atom:Segmented IsExpanding="True">
|
||||
<atom:SegmentedItem>123</atom:SegmentedItem>
|
||||
@ -51,7 +51,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three sizes of Segmented" Description="There are three sizes of an Segmented: large (40px), default (32px) and small (24px).">
|
||||
<desktop:ShowCaseItem Title="Three sizes of Segmented"
|
||||
Description="There are three sizes of an Segmented: large (40px), default (32px) and small (24px).">
|
||||
<StackPanel HorizontalAlignment="Left"
|
||||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
|
@ -8,5 +8,4 @@ public partial class SegmentedShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Horizontal" Description="A Separator is horizontal by default. You can add text within Separator.">
|
||||
<desktop:ShowCaseItem Title="Horizontal"
|
||||
Description="A Separator is horizontal by default. You can add text within Separator.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.
|
||||
@ -24,7 +24,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Divider with title" Description="Divider with inner title, set orientation='left/right' to align it.">
|
||||
<desktop:ShowCaseItem Title="Divider with title"
|
||||
Description="Divider with inner title, set orientation='left/right' to align it.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.
|
||||
@ -65,7 +66,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Text without heading style" Description="You can use non-heading style of divider text by setting the plain property.">
|
||||
<desktop:ShowCaseItem Title="Text without heading style"
|
||||
Description="You can use non-heading style of divider text by setting the plain property.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.
|
||||
|
@ -8,5 +8,4 @@ public partial class SeparatorShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Basic slider. When range is true, display as dual thumb mode. When disable is true, the slider will not be interactable.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="Basic slider. When range is true, display as dual thumb mode. When disable is true, the slider will not be interactable.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:Slider IsEnabled="{Binding NormalEnabled}"
|
||||
Maximum="100"
|
||||
@ -37,7 +37,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Customize tooltip" Description="Use tooltip.formatter to format content of Tooltip. If tooltip.formatter is null, hide it.">
|
||||
<desktop:ShowCaseItem Title="Customize tooltip"
|
||||
Description="Use tooltip.formatter to format content of Tooltip. If tooltip.formatter is null, hide it.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:Slider IsSnapToTickEnabled="True"
|
||||
Maximum="100"
|
||||
@ -84,7 +85,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Graduated slider" Description="Using marks property to mark a graduated slider, use value or defaultValue to specify the position of thumb. When included is false, means that different thumbs are coordinative. when step is null, users can only slide the thumbs onto marks.">
|
||||
<desktop:ShowCaseItem Title="Graduated slider"
|
||||
Description="Using marks property to mark a graduated slider, use value or defaultValue to specify the position of thumb. When included is false, means that different thumbs are coordinative. when step is null, users can only slide the thumbs onto marks.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<TextBlock FontWeight="Bold">included=true</TextBlock>
|
||||
<atom:Slider Marks="{Binding SliderMarks}"
|
||||
|
@ -8,23 +8,12 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
public partial class SliderShowCase : UserControl
|
||||
{
|
||||
|
||||
public static readonly StyledProperty<AvaloniaList<SliderMark>?> SliderMarksProperty =
|
||||
AvaloniaProperty.Register<SliderShowCase, AvaloniaList<SliderMark>?>(nameof(SliderMarks));
|
||||
|
||||
public static readonly StyledProperty<bool> NormalDisabledProperty =
|
||||
AvaloniaProperty.Register<SliderShowCase, bool>(nameof(NormalEnabled), true);
|
||||
|
||||
public AvaloniaList<SliderMark>? SliderMarks {
|
||||
get => GetValue(SliderMarksProperty);
|
||||
set => SetValue(SliderMarksProperty, value);
|
||||
}
|
||||
|
||||
public bool NormalEnabled {
|
||||
get => GetValue(NormalDisabledProperty);
|
||||
set => SetValue(NormalDisabledProperty, value);
|
||||
}
|
||||
|
||||
public SliderShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -40,4 +29,15 @@ public partial class SliderShowCase : UserControl
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public AvaloniaList<SliderMark>? SliderMarks
|
||||
{
|
||||
get => GetValue(SliderMarksProperty);
|
||||
set => SetValue(SliderMarksProperty, value);
|
||||
}
|
||||
|
||||
public bool NormalEnabled
|
||||
{
|
||||
get => GetValue(NormalDisabledProperty);
|
||||
set => SetValue(NormalDisabledProperty, value);
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The most basic SplitButton.">
|
||||
@ -27,7 +26,8 @@
|
||||
</atom:SplitButton>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="AtomUI supports three sizes of buttons: small, default and large. If a large or small button is desired, set the size property to either large or small respectively. Omit the size property for a button with the default size.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="AtomUI supports three sizes of buttons: small, default and large. If a large or small button is desired, set the size property to either large or small respectively. Omit the size property for a button with the default size.">
|
||||
<desktop:ShowCaseItem.Styles>
|
||||
<Style Selector="atom|SplitButton">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
|
@ -23,14 +23,8 @@ public partial class SwitchShowCase : UserControl
|
||||
var stackPanel = btn.Parent as StackPanel;
|
||||
var toggleSwitchDefault = stackPanel?.Children[0] as ToggleSwitch;
|
||||
var toggleSwitchSmall = stackPanel?.Children[1] as ToggleSwitch;
|
||||
if (toggleSwitchDefault is not null) {
|
||||
toggleSwitchDefault.IsLoading = !toggleSwitchDefault.IsLoading;
|
||||
}
|
||||
if (toggleSwitchDefault is not null) toggleSwitchDefault.IsLoading = !toggleSwitchDefault.IsLoading;
|
||||
|
||||
if (toggleSwitchSmall is not null) {
|
||||
toggleSwitchSmall.IsLoading = !toggleSwitchSmall.IsLoading;
|
||||
if (toggleSwitchSmall is not null) toggleSwitchSmall.IsLoading = !toggleSwitchSmall.IsLoading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<TabControl>
|
||||
<TabItem Header="TabControl">
|
||||
@ -64,7 +63,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Slide" Description="In order to fit in more tabs, they can slide left and right (or up and down).">
|
||||
<desktop:ShowCaseItem Title="Slide"
|
||||
Description="In order to fit in more tabs, they can slide left and right (or up and down).">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:TabControl>
|
||||
<atom:TabItem Header="Tab 1">Content of Tab Pane 1</atom:TabItem>
|
||||
@ -114,7 +114,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Card type tab" Description="Another type of Tabs, which doesn't support vertical mode.">
|
||||
<desktop:ShowCaseItem Title="Card type tab"
|
||||
Description="Another type of Tabs, which doesn't support vertical mode.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
|
||||
<atom:CardTabControl>
|
||||
@ -126,7 +127,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Position" Description="Tab's position: left, right, top or bottom. Will auto switch to top in mobile.">
|
||||
<desktop:ShowCaseItem Title="Position"
|
||||
Description="Tab's position: left, right, top or bottom. Will auto switch to top in mobile.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<TextBlock VerticalAlignment="Center">Tab position:</TextBlock>
|
||||
@ -197,7 +199,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="Large size tabs are usually used in page header, and small size could be used in Modal.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="Large size tabs are usually used in page header, and small size could be used in Modal.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<TextBlock VerticalAlignment="Center">Tab position:</TextBlock>
|
||||
@ -294,7 +297,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Slide" Description="In order to fit in more tabs, they can slide left and right (or up and down).">
|
||||
<desktop:ShowCaseItem Title="Slide"
|
||||
Description="In order to fit in more tabs, they can slide left and right (or up and down).">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:TabStrip>
|
||||
<atom:TabStripItem>Tab 1</atom:TabStripItem>
|
||||
@ -324,7 +328,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Card type tab" Description="Another type of Tabs, which doesn't support vertical mode.">
|
||||
<desktop:ShowCaseItem Title="Card type tab"
|
||||
Description="Another type of Tabs, which doesn't support vertical mode.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<atom:CardTabStrip>
|
||||
<atom:TabStripItem Icon="{atom:IconProvider Kind=AppleOutlined}">Tab 1</atom:TabStripItem>
|
||||
@ -336,7 +341,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Position" Description="Tab's position: left, right, top or bottom. Will auto switch to top in mobile.">
|
||||
<desktop:ShowCaseItem Title="Position"
|
||||
Description="Tab's position: left, right, top or bottom. Will auto switch to top in mobile.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<TextBlock VerticalAlignment="Center">Tab position:</TextBlock>
|
||||
@ -401,7 +407,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Size" Description="Large size tabs are usually used in page header, and small size could be used in Modal.">
|
||||
<desktop:ShowCaseItem Title="Size"
|
||||
Description="Large size tabs are usually used in page header, and small size could be used in Modal.">
|
||||
<StackPanel Orientation="Vertical" Spacing="20">
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<TextBlock VerticalAlignment="Center">Tab position:</TextBlock>
|
||||
|
@ -8,6 +8,23 @@ namespace AtomUI.Demo.Desktop.ShowCase;
|
||||
|
||||
public partial class TabControlShowCase : UserControl
|
||||
{
|
||||
public TabControlShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
PositionTabStripOptionGroup.OptionCheckedChanged += HandleTabStripPlacementOptionCheckedChanged;
|
||||
PositionCardTabStripOptionGroup.OptionCheckedChanged += HandleCardTabStripPlacementOptionCheckedChanged;
|
||||
SizeTypeTabStripOptionGroup.OptionCheckedChanged += HandleTabStripSizeTypeOptionCheckedChanged;
|
||||
AddTabDemoStrip.AddTabRequest += HandleTabStripAddTabRequest;
|
||||
|
||||
PositionTabControlOptionGroup.OptionCheckedChanged += HandleTabControlPlacementOptionCheckedChanged;
|
||||
PositionCardTabControlOptionGroup.OptionCheckedChanged += HandleCardTabControlPlacementOptionCheckedChanged;
|
||||
SizeTypeTabControlOptionGroup.OptionCheckedChanged += HandleTabControlSizeTypeOptionCheckedChanged;
|
||||
AddTabDemoTabControl.AddTabRequest += HandleTabControlAddTabRequest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region TabStrip
|
||||
|
||||
public static readonly StyledProperty<Dock> PositionTabStripPlacementProperty =
|
||||
@ -39,6 +56,8 @@ public partial class TabControlShowCase : UserControl
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region TabControl
|
||||
|
||||
public static readonly StyledProperty<Dock> PositionTabControlPlacementProperty =
|
||||
@ -70,118 +89,104 @@ public partial class TabControlShowCase : UserControl
|
||||
|
||||
#endregion
|
||||
|
||||
public TabControlShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
PositionTabStripOptionGroup.OptionCheckedChanged += HandleTabStripPlacementOptionCheckedChanged;
|
||||
PositionCardTabStripOptionGroup.OptionCheckedChanged += HandleCardTabStripPlacementOptionCheckedChanged;
|
||||
SizeTypeTabStripOptionGroup.OptionCheckedChanged += HandleTabStripSizeTypeOptionCheckedChanged;
|
||||
AddTabDemoStrip.AddTabRequest += HandleTabStripAddTabRequest;
|
||||
|
||||
PositionTabControlOptionGroup.OptionCheckedChanged += HandleTabControlPlacementOptionCheckedChanged;
|
||||
PositionCardTabControlOptionGroup.OptionCheckedChanged += HandleCardTabControlPlacementOptionCheckedChanged;
|
||||
SizeTypeTabControlOptionGroup.OptionCheckedChanged += HandleTabControlSizeTypeOptionCheckedChanged;
|
||||
AddTabDemoTabControl.AddTabRequest += HandleTabControlAddTabRequest;
|
||||
}
|
||||
|
||||
#region TabStrip
|
||||
|
||||
private void HandleTabStripPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
PositionTabStripPlacement = Dock.Top;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
PositionTabStripPlacement = Dock.Bottom;
|
||||
} else if (args.Index == 2) {
|
||||
else if (args.Index == 2)
|
||||
PositionTabStripPlacement = Dock.Left;
|
||||
} else {
|
||||
else
|
||||
PositionTabStripPlacement = Dock.Right;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCardTabStripPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
PositionCardTabStripPlacement = Dock.Top;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
PositionCardTabStripPlacement = Dock.Bottom;
|
||||
} else if (args.Index == 2) {
|
||||
else if (args.Index == 2)
|
||||
PositionCardTabStripPlacement = Dock.Left;
|
||||
} else {
|
||||
else
|
||||
PositionCardTabStripPlacement = Dock.Right;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleTabStripSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
SizeTypeTabStrip = SizeType.Small;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
SizeTypeTabStrip = SizeType.Middle;
|
||||
} else {
|
||||
else
|
||||
SizeTypeTabStrip = SizeType.Large;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleTabStripAddTabRequest(object? sender, RoutedEventArgs args)
|
||||
{
|
||||
var index = AddTabDemoStrip.ItemCount;
|
||||
AddTabDemoStrip.Items.Add(new TabStripItem()
|
||||
AddTabDemoStrip.Items.Add(new TabStripItem
|
||||
{
|
||||
Content = $"new tab {index}",
|
||||
IsClosable = true
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region TabControl
|
||||
|
||||
private void HandleTabControlPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
PositionTabControlPlacement = Dock.Top;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
PositionTabControlPlacement = Dock.Bottom;
|
||||
} else if (args.Index == 2) {
|
||||
else if (args.Index == 2)
|
||||
PositionTabControlPlacement = Dock.Left;
|
||||
} else {
|
||||
else
|
||||
PositionTabControlPlacement = Dock.Right;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCardTabControlPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
PositionCardTabControlPlacement = Dock.Top;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
PositionCardTabControlPlacement = Dock.Bottom;
|
||||
} else if (args.Index == 2) {
|
||||
else if (args.Index == 2)
|
||||
PositionCardTabControlPlacement = Dock.Left;
|
||||
} else {
|
||||
else
|
||||
PositionCardTabControlPlacement = Dock.Right;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleTabControlSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
|
||||
{
|
||||
if (args.Index == 0) {
|
||||
if (args.Index == 0)
|
||||
SizeTypeTabControl = SizeType.Small;
|
||||
} else if (args.Index == 1) {
|
||||
else if (args.Index == 1)
|
||||
SizeTypeTabControl = SizeType.Middle;
|
||||
} else {
|
||||
else
|
||||
SizeTypeTabControl = SizeType.Large;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleTabControlAddTabRequest(object? sender, RoutedEventArgs args)
|
||||
{
|
||||
var index = AddTabDemoTabControl.ItemCount;
|
||||
AddTabDemoTabControl.Items.Add(new TabItem()
|
||||
AddTabDemoTabControl.Items.Add(new TabItem
|
||||
{
|
||||
Header = $"new tab {index}",
|
||||
Content = $"new tab content {index}",
|
||||
IsClosable = true
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCasePanel.Styles>
|
||||
@ -13,7 +12,8 @@
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
||||
</desktop:ShowCasePanel.Styles>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Usage of basic Tag, and it could be IsClosable and customize close button by set closeIcon property,will display default close button when closeIcon is setting to true. IsClosable Tag supports onClose events.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="Usage of basic Tag, and it could be IsClosable and customize close button by set closeIcon property,will display default close button when closeIcon is setting to true. IsClosable Tag supports onClose events.">
|
||||
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<atom:Tag>Tag 1</atom:Tag>
|
||||
<atom:Tag>Link</atom:Tag>
|
||||
@ -27,7 +27,8 @@
|
||||
</WrapPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Colorful Tag" Description="We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color.">
|
||||
<desktop:ShowCaseItem Title="Colorful Tag"
|
||||
Description="We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color.">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Margin="0,0,0,10"
|
||||
FontSize="14"
|
||||
@ -63,7 +64,8 @@
|
||||
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status Tag" Description="We preset five different colors, you can set color property such as success,processing,error,default and warning to indicate specific status.">
|
||||
<desktop:ShowCaseItem Title="Status Tag"
|
||||
Description="We preset five different colors, you can set color property such as success,processing,error,default and warning to indicate specific status.">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Margin="0,0,0,10"
|
||||
FontSize="14"
|
||||
@ -125,7 +127,8 @@
|
||||
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Icon" Description="Tag components can contain an Icon. This is done by setting the icon property or placing an Icon component within the Tag. If you want specific control over the positioning and placement of the Icon, then that should be done by placing the Icon component within the Tag rather than using the icon property.">
|
||||
<desktop:ShowCaseItem Title="Icon"
|
||||
Description="Tag components can contain an Icon. This is done by setting the icon property or placing an Icon component within the Tag. If you want specific control over the positioning and placement of the Icon, then that should be done by placing the Icon component within the Tag rather than using the icon property.">
|
||||
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<atom:Tag TagColor="#55acee">
|
||||
<atom:Tag.Icon>
|
||||
|
@ -8,5 +8,4 @@ public partial class TagShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -5,14 +5,15 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="Click TimePicker, and then we could select or input a time in panel.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="Click TimePicker, and then we could select or input a time in panel.">
|
||||
<atom:TimePicker Width="200" Watermark="Select time" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Three Sizes" Description="The input box comes in three sizes: large, middle and small. Large is used in the form, while the medium size is the default.">
|
||||
<desktop:ShowCaseItem Title="Three Sizes"
|
||||
Description="The input box comes in three sizes: large, middle and small. Large is used in the form, while the medium size is the default.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:TimePicker Width="160"
|
||||
DefaultTime="12:08:23"
|
||||
@ -38,7 +39,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Interval option" Description="Show stepped options by MinuteIncrement SecondIncrement.">
|
||||
<desktop:ShowCaseItem Title="Interval option"
|
||||
Description="Show stepped options by MinuteIncrement SecondIncrement.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:TimePicker Width="160"
|
||||
DefaultTime="12:08:23"
|
||||
@ -48,7 +50,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="12 hours" Description="TimePicker of 12 hours format, with default format h:mm:ss a.">
|
||||
<desktop:ShowCaseItem Title="12 hours"
|
||||
Description="TimePicker of 12 hours format, with default format h:mm:ss a.">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<atom:TimePicker Width="160"
|
||||
ClockIdentifier="HourClock12"
|
||||
@ -90,7 +93,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Status" Description="Add status to TimePicker with status, which could be error or warning.">
|
||||
<desktop:ShowCaseItem Title="Status"
|
||||
Description="Add status to TimePicker with status, which could be error or warning.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<atom:TimePicker Width="160"
|
||||
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.TimelineShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -8,5 +8,4 @@ public partial class TimelineShowCase : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.TitleBarShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="AtomUI.Demo.Desktop.ShowCase.ToolBarShowCase"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel />
|
||||
</UserControl>
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The simplest usage.">
|
||||
@ -256,7 +255,8 @@
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Colorful Tooltip" Description="We preset a series of colorful Tooltip styles for use in different situations.">
|
||||
<desktop:ShowCaseItem Title="Colorful Tooltip"
|
||||
Description="We preset a series of colorful Tooltip styles for use in different situations.">
|
||||
<desktop:ShowCaseItem.Styles>
|
||||
<Style Selector="atom|Button">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
|
@ -10,9 +10,35 @@ public partial class TooltipShowCase : UserControl
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
|
||||
|
||||
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter), false);
|
||||
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter));
|
||||
|
||||
private Segmented _segmented;
|
||||
private readonly Segmented _segmented;
|
||||
|
||||
public TooltipShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
var control = this as Control;
|
||||
_segmented = control.FindControl<Segmented>("ArrowSegmented")!;
|
||||
_segmented.SelectionChanged += (sender, args) =>
|
||||
{
|
||||
if (_segmented.SelectedIndex == 0)
|
||||
{
|
||||
ShowArrow = true;
|
||||
IsPointAtCenter = false;
|
||||
}
|
||||
else if (_segmented.SelectedIndex == 1)
|
||||
{
|
||||
ShowArrow = false;
|
||||
IsPointAtCenter = false;
|
||||
}
|
||||
else if (_segmented.SelectedIndex == 2)
|
||||
{
|
||||
IsPointAtCenter = true;
|
||||
ShowArrow = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public bool ShowArrow
|
||||
{
|
||||
@ -25,26 +51,4 @@ public partial class TooltipShowCase : UserControl
|
||||
get => GetValue(IsPointAtCenterProperty);
|
||||
set => SetValue(IsPointAtCenterProperty, value);
|
||||
}
|
||||
|
||||
public TooltipShowCase()
|
||||
{
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
var control = this as Control;
|
||||
_segmented = control.FindControl<Segmented>("ArrowSegmented")!;
|
||||
_segmented.SelectionChanged += (sender, args) =>
|
||||
{
|
||||
if (_segmented.SelectedIndex == 0) {
|
||||
ShowArrow = true;
|
||||
IsPointAtCenter = false;
|
||||
} else if (_segmented.SelectedIndex == 1) {
|
||||
ShowArrow = false;
|
||||
IsPointAtCenter = false;
|
||||
} else if (_segmented.SelectedIndex == 2) {
|
||||
IsPointAtCenter = true;
|
||||
ShowArrow = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
<desktop:ShowCaseItem Title="Basic" Description="The most basic usage, tell you how to use checkable, selectable, disabled, defaultExpandKeys, and etc.">
|
||||
<desktop:ShowCaseItem Title="Basic"
|
||||
Description="The most basic usage, tell you how to use checkable, selectable, disabled, defaultExpandKeys, and etc.">
|
||||
<atom:TreeView IsCheckable="True" IsDefaultExpandAll="True">
|
||||
<atom:TreeViewItem Header="parent 1">
|
||||
<atom:TreeViewItem Header="parent 1-0">
|
||||
@ -35,7 +35,8 @@
|
||||
</atom:TreeView>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Tree with line" Description="Tree with connected line between nodes, turn on by showLine, customize the preset icon by switcherIcon.">
|
||||
<desktop:ShowCaseItem Title="Tree with line"
|
||||
Description="Tree with connected line between nodes, turn on by showLine, customize the preset icon by switcherIcon.">
|
||||
<StackPanel Orientation="Vertical" Spacing="10">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock>showLine:</TextBlock>
|
||||
|
@ -9,10 +9,16 @@ public partial class TreeViewShowCase : UserControl
|
||||
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLineSwitchChecked), true);
|
||||
|
||||
public static readonly StyledProperty<bool> ShowIconSwitchCheckedProperty =
|
||||
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowIconSwitchChecked), false);
|
||||
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowIconSwitchChecked));
|
||||
|
||||
public static readonly StyledProperty<bool> ShowLeafSwitcherSwitchCheckedProperty =
|
||||
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLeafSwitcherSwitchChecked), false);
|
||||
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLeafSwitcherSwitchChecked));
|
||||
|
||||
public TreeViewShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public bool ShowLineSwitchChecked
|
||||
{
|
||||
@ -31,11 +37,4 @@ public partial class TreeViewShowCase : UserControl
|
||||
get => GetValue(ShowLeafSwitcherSwitchCheckedProperty);
|
||||
set => SetValue(ShowLeafSwitcherSwitchCheckedProperty, value);
|
||||
}
|
||||
|
||||
public TreeViewShowCase()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:desktop="clr-namespace:AtomUI.Demo.Desktop"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:showcase="clr-namespace:AtomUI.Demo.Desktop.ShowCase"
|
||||
mc:Ignorable="d">
|
||||
<desktop:ShowCasePanel>
|
||||
|
||||
@ -13,11 +12,14 @@
|
||||
<Border Height="300" atom:Watermark.Glyph="{atom:TextGlyph 'AtomUI'}" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Multi-line watermark" Description="Use line-break to specify multi-line text watermark content.">
|
||||
<Border Height="200" atom:Watermark.Glyph="{atom:TextGlyph 'AtomUI
Happy Working', FontSize=18, Foreground=Gray}" />
|
||||
<desktop:ShowCaseItem Title="Multi-line watermark"
|
||||
Description="Use line-break to specify multi-line text watermark content.">
|
||||
<Border Height="200"
|
||||
atom:Watermark.Glyph="{atom:TextGlyph 'AtomUI
Happy Working', FontSize=18, Foreground=Gray}" />
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Image watermark" Description="Specify the image address via image. To ensure that the image is high definition and not stretched, set the width and height, and upload at least twice the width and height of the logo image address.">
|
||||
<desktop:ShowCaseItem Title="Image watermark"
|
||||
Description="Specify the image address via image. To ensure that the image is high definition and not stretched, set the width and height, and upload at least twice the width and height of the logo image address.">
|
||||
<Border Height="400">
|
||||
<atom:Watermark.Glyph>
|
||||
<atom:ImageGlyph Source="/Assets/ATOMUI-LOGO.png" />
|
||||
@ -26,12 +28,16 @@
|
||||
</Border>
|
||||
</desktop:ShowCaseItem>
|
||||
|
||||
<desktop:ShowCaseItem Title="Custom configuration" Description="Preview the watermark effect by configuring custom parameters.">
|
||||
<desktop:ShowCaseItem Title="Custom configuration"
|
||||
Description="Preview the watermark effect by configuring custom parameters.">
|
||||
<StackPanel atom:Watermark.Glyph="{atom:TextGlyph 'AtomUI'}">
|
||||
<TextBlock TextWrapping="Wrap">
|
||||
The light-speed iteration of the digital world makes products more complex. However, human consciousness and attention resources are limited. Facing this design contradiction, the pursuit of natural interaction will be the consistent direction of Ant Design.<LineBreak /><LineBreak />
|
||||
Natural user cognition: According to cognitive psychology, about 80% of external information is obtained through visual channels. The most important visual elements in the interface design, including layout, colors, illustrations, icons, etc., should fully absorb the laws of nature, thereby reducing the user's cognitive cost and bringing authentic and smooth feelings. In some scenarios, opportunely adding other sensory channels such as hearing, touch can create a richer and more natural product experience.<LineBreak /><LineBreak />
|
||||
Natural user behavior: In the interaction with the system, the designer should fully understand the relationship between users, system roles, and task objectives, and also contextually organize system functions and services. At the same time, a series of methods such as behavior analysis, artificial intelligence and sensors could be applied to assist users to make effective decisions and reduce extra operations of users, to save users' mental and physical resources and make human-computer interaction more natural.</TextBlock>
|
||||
The light-speed iteration of the digital world makes products more complex. However, human consciousness and attention resources are limited. Facing this design contradiction, the pursuit of natural interaction will be the consistent direction of Ant Design.
|
||||
<LineBreak /><LineBreak />
|
||||
Natural user cognition: According to cognitive psychology, about 80% of external information is obtained through visual channels. The most important visual elements in the interface design, including layout, colors, illustrations, icons, etc., should fully absorb the laws of nature, thereby reducing the user's cognitive cost and bringing authentic and smooth feelings. In some scenarios, opportunely adding other sensory channels such as hearing, touch can create a richer and more natural product experience.
|
||||
<LineBreak /><LineBreak />
|
||||
Natural user behavior: In the interaction with the system, the designer should fully understand the relationship between users, system roles, and task objectives, and also contextually organize system functions and services. At the same time, a series of methods such as behavior analysis, artificial intelligence and sensors could be applied to assist users to make effective decisions and reduce extra operations of users, to save users' mental and physical resources and make human-computer interaction more natural.
|
||||
</TextBlock>
|
||||
<Image Source="/Assets/watermark-sample.png" />
|
||||
</StackPanel>
|
||||
</desktop:ShowCaseItem>
|
||||
|
@ -20,7 +20,8 @@
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsPresenter.ItemsPanel>
|
||||
</ItemsPresenter>
|
||||
<Border Name="PART_BorderSeparator" Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
||||
<Border Name="PART_BorderSeparator"
|
||||
Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
||||
</Panel>
|
||||
</ScrollViewer>
|
||||
<ContentPresenter Name="PART_SelectedContentHost"
|
||||
|
@ -1,21 +1,20 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Xaml markup to get the enum values.
|
||||
/// </summary>
|
||||
/// TODO 优化性能时可以考虑缓存类型和列表
|
||||
public class EnumExtension : MarkupExtension
|
||||
{
|
||||
[ConstructorArgument(nameof(Type))]
|
||||
public Type Type { get; set; }
|
||||
namespace AtomUI.Demo.Desktop.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// Xaml markup to get the enum values.
|
||||
/// </summary>
|
||||
/// TODO 优化性能时可以考虑缓存类型和列表
|
||||
public class EnumExtension : MarkupExtension
|
||||
{
|
||||
public EnumExtension(Type type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
[ConstructorArgument(nameof(Type))] public Type Type { get; set; }
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
// Issue I7:
|
||||
@ -24,5 +23,4 @@ namespace AtomUI.Demo.Desktop.Utils
|
||||
// By nlb at 2023.3.28.
|
||||
return Enum.GetValues(Type).OfType<object>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,69 +4,23 @@ namespace AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
public class CheckBoxShowCaseModel : ObservableObject
|
||||
{
|
||||
public bool? _controlledCheckBoxCheckedStatus;
|
||||
public bool? ControlledCheckBoxCheckedStatus
|
||||
{
|
||||
get => _controlledCheckBoxCheckedStatus;
|
||||
set => SetProperty(ref _controlledCheckBoxCheckedStatus, value);
|
||||
}
|
||||
|
||||
public bool _controlledCheckBoxEnabledStatus;
|
||||
public bool ControlledCheckBoxEnabledStatus
|
||||
{
|
||||
get => _controlledCheckBoxEnabledStatus;
|
||||
set => SetProperty(ref _controlledCheckBoxEnabledStatus, value);
|
||||
}
|
||||
|
||||
private string? _checkStatusBtnText;
|
||||
public string? CheckStatusBtnText
|
||||
{
|
||||
get => _checkStatusBtnText;
|
||||
set => SetProperty(ref _checkStatusBtnText, value);
|
||||
}
|
||||
|
||||
private string? _enableStatusBtnText;
|
||||
public string? EnableStatusBtnText
|
||||
{
|
||||
get => _enableStatusBtnText;
|
||||
set => SetProperty(ref _enableStatusBtnText, value);
|
||||
}
|
||||
|
||||
private string? _controlledCheckBoxText;
|
||||
public string? ControlledCheckBoxText
|
||||
{
|
||||
get => _controlledCheckBoxText;
|
||||
set => SetProperty(ref _controlledCheckBoxText, value);
|
||||
}
|
||||
private bool _appleCheckedStatus;
|
||||
|
||||
// CheckAll 例子
|
||||
private bool? _checkedAllStatus;
|
||||
public bool? CheckedAllStatus
|
||||
{
|
||||
get => _checkedAllStatus;
|
||||
set => SetProperty(ref _checkedAllStatus, value);
|
||||
}
|
||||
|
||||
private bool _appleCheckedStatus;
|
||||
public bool AppleCheckedStatus
|
||||
{
|
||||
get => _appleCheckedStatus;
|
||||
set => SetProperty(ref _appleCheckedStatus, value);
|
||||
}
|
||||
private string? _checkStatusBtnText;
|
||||
public bool? _controlledCheckBoxCheckedStatus;
|
||||
|
||||
private bool _pearCheckedStatus;
|
||||
public bool PearCheckedStatus
|
||||
{
|
||||
get => _pearCheckedStatus;
|
||||
set => SetProperty(ref _pearCheckedStatus, value);
|
||||
}
|
||||
public bool _controlledCheckBoxEnabledStatus;
|
||||
|
||||
private string? _controlledCheckBoxText;
|
||||
|
||||
private string? _enableStatusBtnText;
|
||||
|
||||
private bool _orangeCheckedStatus;
|
||||
public bool OrangeCheckedStatus
|
||||
{
|
||||
get => _orangeCheckedStatus;
|
||||
set => SetProperty(ref _orangeCheckedStatus, value);
|
||||
}
|
||||
|
||||
private bool _pearCheckedStatus;
|
||||
|
||||
public CheckBoxShowCaseModel()
|
||||
{
|
||||
@ -82,6 +36,60 @@ public class CheckBoxShowCaseModel : ObservableObject
|
||||
CheckedAllStatus = null;
|
||||
}
|
||||
|
||||
public bool? ControlledCheckBoxCheckedStatus
|
||||
{
|
||||
get => _controlledCheckBoxCheckedStatus;
|
||||
set => SetProperty(ref _controlledCheckBoxCheckedStatus, value);
|
||||
}
|
||||
|
||||
public bool ControlledCheckBoxEnabledStatus
|
||||
{
|
||||
get => _controlledCheckBoxEnabledStatus;
|
||||
set => SetProperty(ref _controlledCheckBoxEnabledStatus, value);
|
||||
}
|
||||
|
||||
public string? CheckStatusBtnText
|
||||
{
|
||||
get => _checkStatusBtnText;
|
||||
set => SetProperty(ref _checkStatusBtnText, value);
|
||||
}
|
||||
|
||||
public string? EnableStatusBtnText
|
||||
{
|
||||
get => _enableStatusBtnText;
|
||||
set => SetProperty(ref _enableStatusBtnText, value);
|
||||
}
|
||||
|
||||
public string? ControlledCheckBoxText
|
||||
{
|
||||
get => _controlledCheckBoxText;
|
||||
set => SetProperty(ref _controlledCheckBoxText, value);
|
||||
}
|
||||
|
||||
public bool? CheckedAllStatus
|
||||
{
|
||||
get => _checkedAllStatus;
|
||||
set => SetProperty(ref _checkedAllStatus, value);
|
||||
}
|
||||
|
||||
public bool AppleCheckedStatus
|
||||
{
|
||||
get => _appleCheckedStatus;
|
||||
set => SetProperty(ref _appleCheckedStatus, value);
|
||||
}
|
||||
|
||||
public bool PearCheckedStatus
|
||||
{
|
||||
get => _pearCheckedStatus;
|
||||
set => SetProperty(ref _pearCheckedStatus, value);
|
||||
}
|
||||
|
||||
public bool OrangeCheckedStatus
|
||||
{
|
||||
get => _orangeCheckedStatus;
|
||||
set => SetProperty(ref _orangeCheckedStatus, value);
|
||||
}
|
||||
|
||||
public void CheckStatusHandler(object arg)
|
||||
{
|
||||
ControlledCheckBoxCheckedStatus = !ControlledCheckBoxCheckedStatus;
|
||||
@ -104,47 +112,48 @@ public class CheckBoxShowCaseModel : ObservableObject
|
||||
|
||||
private void SetupCheckBtnText()
|
||||
{
|
||||
if (ControlledCheckBoxCheckedStatus.HasValue) {
|
||||
if (ControlledCheckBoxCheckedStatus.Value) {
|
||||
if (ControlledCheckBoxCheckedStatus.HasValue)
|
||||
{
|
||||
if (ControlledCheckBoxCheckedStatus.Value)
|
||||
CheckStatusBtnText = "UnCheck";
|
||||
} else {
|
||||
else
|
||||
CheckStatusBtnText = "Check";
|
||||
}
|
||||
} else {
|
||||
else
|
||||
{
|
||||
CheckStatusBtnText = "Check";
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupEnabledBtnText()
|
||||
{
|
||||
if (ControlledCheckBoxEnabledStatus) {
|
||||
if (ControlledCheckBoxEnabledStatus)
|
||||
EnableStatusBtnText = "Disable";
|
||||
} else {
|
||||
else
|
||||
EnableStatusBtnText = "Enable";
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupControlledCheckBoxText()
|
||||
{
|
||||
var checkedText = "UnChecked";
|
||||
if (ControlledCheckBoxCheckedStatus.HasValue && ControlledCheckBoxCheckedStatus.Value) {
|
||||
checkedText = "Checked";
|
||||
}
|
||||
if (ControlledCheckBoxCheckedStatus.HasValue && ControlledCheckBoxCheckedStatus.Value) checkedText = "Checked";
|
||||
|
||||
var enabledText = "Disabled";
|
||||
if (ControlledCheckBoxEnabledStatus) {
|
||||
enabledText = "Enabled";
|
||||
}
|
||||
if (ControlledCheckBoxEnabledStatus) enabledText = "Enabled";
|
||||
|
||||
ControlledCheckBoxText = $"{checkedText}-{enabledText}";
|
||||
}
|
||||
|
||||
public void CheckedAllStatusHandler()
|
||||
{
|
||||
if (!CheckedAllStatus.HasValue || !CheckedAllStatus.Value) {
|
||||
if (!CheckedAllStatus.HasValue || !CheckedAllStatus.Value)
|
||||
{
|
||||
AppleCheckedStatus = false;
|
||||
PearCheckedStatus = false;
|
||||
OrangeCheckedStatus = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
AppleCheckedStatus = true;
|
||||
PearCheckedStatus = true;
|
||||
OrangeCheckedStatus = true;
|
||||
@ -153,12 +162,11 @@ public class CheckBoxShowCaseModel : ObservableObject
|
||||
|
||||
public void CheckedItemStatusHandler(object arg)
|
||||
{
|
||||
if (OrangeCheckedStatus && PearCheckedStatus && AppleCheckedStatus) {
|
||||
if (OrangeCheckedStatus && PearCheckedStatus && AppleCheckedStatus)
|
||||
CheckedAllStatus = true;
|
||||
} else if (!OrangeCheckedStatus && !PearCheckedStatus && !AppleCheckedStatus) {
|
||||
else if (!OrangeCheckedStatus && !PearCheckedStatus && !AppleCheckedStatus)
|
||||
CheckedAllStatus = false;
|
||||
} else {
|
||||
else
|
||||
CheckedAllStatus = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,22 +5,14 @@ using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
public class DataGridDemoViewModel: ObservableObject
|
||||
public class DataGridDemoViewModel : ObservableObject
|
||||
{
|
||||
public ObservableCollection<Song> GridData1 { get; set; }
|
||||
|
||||
public DataGridCollectionView GridData2 { get; set; }
|
||||
|
||||
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
||||
|
||||
public RelayCommand AddCommand { get; set; }
|
||||
|
||||
public DataGridDemoViewModel()
|
||||
{
|
||||
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
||||
GridData2 = new DataGridCollectionView(Song.Songs);
|
||||
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
|
||||
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a=>new SongViewModel()
|
||||
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a => new SongViewModel
|
||||
{
|
||||
Title = a.Title,
|
||||
Artist = a.Artist,
|
||||
@ -31,21 +23,23 @@ public class DataGridDemoViewModel: ObservableObject
|
||||
AddCommand = new RelayCommand(Add);
|
||||
}
|
||||
|
||||
public ObservableCollection<Song> GridData1 { get; set; }
|
||||
|
||||
public DataGridCollectionView GridData2 { get; set; }
|
||||
|
||||
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
||||
|
||||
public RelayCommand AddCommand { get; set; }
|
||||
|
||||
private void Add()
|
||||
{
|
||||
GridData3.Add(new SongViewModel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Song
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public string? Artist { get; set; }
|
||||
public TimeSpan? Duration { get; set; }
|
||||
public string? Album { get; set; }
|
||||
public int CountOfComment { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
public Song(string title, string artist, int m, int s, string album, int countOfComment, int netEaseId)
|
||||
{
|
||||
Title = title;
|
||||
@ -54,10 +48,16 @@ public class Song
|
||||
Album = album;
|
||||
CountOfComment = countOfComment;
|
||||
Url = $"https://music.163.com/song?id={netEaseId}";
|
||||
|
||||
}
|
||||
|
||||
public static List<Song> Songs { get; set; } = new List<Song>()
|
||||
public string? Title { get; set; }
|
||||
public string? Artist { get; set; }
|
||||
public TimeSpan? Duration { get; set; }
|
||||
public string? Album { get; set; }
|
||||
public int CountOfComment { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
public static List<Song> Songs { get; set; } = new()
|
||||
{
|
||||
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
|
||||
new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
|
||||
@ -119,41 +119,46 @@ public class Song
|
||||
new("热带季风Remix", "熊猫堂ProducePandas", 3, 22, "W.O.R.L.D.", 23, 2063173319),
|
||||
new("加州梦境", "熊猫堂ProducePandas", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
|
||||
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
|
||||
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775),
|
||||
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775)
|
||||
};
|
||||
}
|
||||
|
||||
public class SongViewModel: ObservableObject
|
||||
|
||||
public class SongViewModel : ObservableObject
|
||||
{
|
||||
private string? _title;
|
||||
private string? _artist;
|
||||
private string? _album;
|
||||
private string? _artist;
|
||||
private int _countOfComment;
|
||||
private bool? _isSelected;
|
||||
private string? _title;
|
||||
|
||||
public string? Title
|
||||
{
|
||||
get => _title;
|
||||
set => SetProperty(ref _title, value);
|
||||
}
|
||||
|
||||
public string? Artist
|
||||
{
|
||||
get => _artist;
|
||||
set => SetProperty(ref _artist, value);
|
||||
}
|
||||
|
||||
public string? Album
|
||||
{
|
||||
get => _album;
|
||||
set => SetProperty(ref _album, value);
|
||||
}
|
||||
|
||||
public int CountOfComment
|
||||
{
|
||||
get => _countOfComment;
|
||||
set => SetProperty(ref _countOfComment, value);
|
||||
}
|
||||
|
||||
public bool? IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
set => SetProperty(ref _isSelected, value);
|
||||
}
|
||||
|
||||
}
|
@ -9,9 +9,9 @@ namespace AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
public class PaletteMetaItem
|
||||
{
|
||||
public string Title;
|
||||
public string Desc;
|
||||
public PresetPrimaryColor PresetPrimaryColor;
|
||||
public string Title;
|
||||
|
||||
public PaletteMetaItem(string title, string desc, PresetPrimaryColor presetPrimaryColor)
|
||||
{
|
||||
@ -21,53 +21,54 @@ public class PaletteMetaItem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class PaletteDemoViewModel : ObservableObject
|
||||
{
|
||||
private readonly PaletteMetaItem[] _presetPaletteInfos =
|
||||
{
|
||||
new PaletteMetaItem("Dust Red / 薄暮", "斗志、奔放", PresetPrimaryColor.Red),
|
||||
new PaletteMetaItem("Volcano / 火山", "醒目、澎湃", PresetPrimaryColor.Volcano),
|
||||
new PaletteMetaItem("Sunset Orange / 日暮", "温暖、欢快", PresetPrimaryColor.Orange),
|
||||
new PaletteMetaItem("Calendula Gold / 金盏花", "活力、积极", PresetPrimaryColor.Gold),
|
||||
new PaletteMetaItem("Sunrise Yellow / 日出", "出生、阳光", PresetPrimaryColor.Yellow),
|
||||
new PaletteMetaItem("Lime / 青柠", "自然、生机", PresetPrimaryColor.Lime),
|
||||
new PaletteMetaItem("Polar Green / 极光绿", "健康、创新", PresetPrimaryColor.Green),
|
||||
new PaletteMetaItem("Cyan / 明青", "希望、坚强", PresetPrimaryColor.Cyan),
|
||||
new PaletteMetaItem("Daybreak Blue / 拂晓蓝", "包容、科技、普惠", PresetPrimaryColor.Blue),
|
||||
new PaletteMetaItem("Geek Blue / 极客蓝", "探索、钻研", PresetPrimaryColor.GeekBlue),
|
||||
new PaletteMetaItem("Golden Purple / 酱紫", "优雅、浪漫", PresetPrimaryColor.Purple),
|
||||
new PaletteMetaItem("Magenta / 法式洋红", "明快、感性", PresetPrimaryColor.Magenta),
|
||||
new("Dust Red / 薄暮", "斗志、奔放", PresetPrimaryColor.Red),
|
||||
new("Volcano / 火山", "醒目、澎湃", PresetPrimaryColor.Volcano),
|
||||
new("Sunset Orange / 日暮", "温暖、欢快", PresetPrimaryColor.Orange),
|
||||
new("Calendula Gold / 金盏花", "活力、积极", PresetPrimaryColor.Gold),
|
||||
new("Sunrise Yellow / 日出", "出生、阳光", PresetPrimaryColor.Yellow),
|
||||
new("Lime / 青柠", "自然、生机", PresetPrimaryColor.Lime),
|
||||
new("Polar Green / 极光绿", "健康、创新", PresetPrimaryColor.Green),
|
||||
new("Cyan / 明青", "希望、坚强", PresetPrimaryColor.Cyan),
|
||||
new("Daybreak Blue / 拂晓蓝", "包容、科技、普惠", PresetPrimaryColor.Blue),
|
||||
new("Geek Blue / 极客蓝", "探索、钻研", PresetPrimaryColor.GeekBlue),
|
||||
new("Golden Purple / 酱紫", "优雅、浪漫", PresetPrimaryColor.Purple),
|
||||
new("Magenta / 法式洋红", "明快、感性", PresetPrimaryColor.Magenta)
|
||||
};
|
||||
|
||||
private ObservableCollection<ColorGroupViewModel>? _darkLists;
|
||||
|
||||
private ObservableCollection<ColorGroupViewModel>? _lightLists;
|
||||
|
||||
private ColorItemViewModel _selectedColor = null!;
|
||||
|
||||
public PaletteDemoViewModel()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Register<PaletteDemoViewModel, ColorItemViewModel>(this, OnClickColorItem);
|
||||
}
|
||||
|
||||
public ColorItemViewModel SelectedColor
|
||||
{
|
||||
get => _selectedColor;
|
||||
set => SetProperty(ref _selectedColor, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<ColorGroupViewModel>? _lightLists;
|
||||
|
||||
public ObservableCollection<ColorGroupViewModel>? LightLists
|
||||
{
|
||||
get => _lightLists;
|
||||
set => SetProperty(ref _lightLists, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<ColorGroupViewModel>? _darkLists;
|
||||
|
||||
public ObservableCollection<ColorGroupViewModel>? DarkLists
|
||||
{
|
||||
get => _darkLists;
|
||||
set => SetProperty(ref _darkLists, value);
|
||||
}
|
||||
|
||||
public PaletteDemoViewModel()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Register<PaletteDemoViewModel, ColorItemViewModel>(this, OnClickColorItem);
|
||||
}
|
||||
|
||||
public void InitializeResources()
|
||||
{
|
||||
InitializePalette();
|
||||
@ -77,17 +78,19 @@ public class PaletteDemoViewModel : ObservableObject
|
||||
{
|
||||
LightLists = new ObservableCollection<ColorGroupViewModel>();
|
||||
var cycleColorList = new ObservableCollection<ColorListViewModel>();
|
||||
int cycleCount = 0;
|
||||
for (int i = 0; i < _presetPaletteInfos.Length; ++i) {
|
||||
var cycleCount = 0;
|
||||
for (var i = 0; i < _presetPaletteInfos.Length; ++i)
|
||||
{
|
||||
var metaInfo = _presetPaletteInfos[i];
|
||||
ColorListViewModel colorListViewModel = new ColorListViewModel();
|
||||
var colorListViewModel = new ColorListViewModel();
|
||||
colorListViewModel.Title = metaInfo.Title;
|
||||
colorListViewModel.Desc = metaInfo.Desc;
|
||||
var paletteInfo = PresetPalettes.GetPresetPalette(metaInfo.PresetPrimaryColor);
|
||||
var colorItemViewModels = new ObservableCollection<ColorItemViewModel>();
|
||||
var presetColorName = metaInfo.PresetPrimaryColor.Name();
|
||||
|
||||
for (int j = 0; j < paletteInfo.ColorSequence.Count; j++) {
|
||||
for (var j = 0; j < paletteInfo.ColorSequence.Count; j++)
|
||||
{
|
||||
var color = paletteInfo.ColorSequence[j];
|
||||
var colorItem = new ColorItemViewModel($"{presetColorName}-{j + 1}",
|
||||
new SolidColorBrush(color),
|
||||
@ -100,7 +103,8 @@ public class PaletteDemoViewModel : ObservableObject
|
||||
cycleColorList.Add(colorListViewModel);
|
||||
++cycleCount;
|
||||
|
||||
if (cycleCount == 3) {
|
||||
if (cycleCount == 3)
|
||||
{
|
||||
var colorGroupModel = new ColorGroupViewModel();
|
||||
colorGroupModel.ColorList = cycleColorList;
|
||||
LightLists.Add(colorGroupModel);
|
||||
@ -111,16 +115,18 @@ public class PaletteDemoViewModel : ObservableObject
|
||||
|
||||
DarkLists = new ObservableCollection<ColorGroupViewModel>();
|
||||
|
||||
for (int i = 0; i < _presetPaletteInfos.Length; ++i) {
|
||||
for (var i = 0; i < _presetPaletteInfos.Length; ++i)
|
||||
{
|
||||
var metaInfo = _presetPaletteInfos[i];
|
||||
ColorListViewModel colorListViewModel = new ColorListViewModel();
|
||||
var colorListViewModel = new ColorListViewModel();
|
||||
colorListViewModel.Title = metaInfo.Title;
|
||||
colorListViewModel.Desc = metaInfo.Desc;
|
||||
var paletteInfo = PresetPalettes.GetPresetPalette(metaInfo.PresetPrimaryColor, true);
|
||||
var colorItemViewModels = new ObservableCollection<ColorItemViewModel>();
|
||||
var presetColorName = metaInfo.PresetPrimaryColor.Name();
|
||||
|
||||
for (int j = 0; j < paletteInfo.ColorSequence.Count; j++) {
|
||||
for (var j = 0; j < paletteInfo.ColorSequence.Count; j++)
|
||||
{
|
||||
var color = paletteInfo.ColorSequence[j];
|
||||
var colorItem = new ColorItemViewModel($"{presetColorName}-{j + 1}",
|
||||
new SolidColorBrush(color),
|
||||
@ -133,7 +139,8 @@ public class PaletteDemoViewModel : ObservableObject
|
||||
cycleColorList.Add(colorListViewModel);
|
||||
++cycleCount;
|
||||
|
||||
if (cycleCount == 3) {
|
||||
if (cycleCount == 3)
|
||||
{
|
||||
var colorGroupModel = new ColorGroupViewModel();
|
||||
colorGroupModel.ColorList = cycleColorList;
|
||||
DarkLists.Add(colorGroupModel);
|
||||
@ -149,6 +156,7 @@ public class PaletteDemoViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ColorGroupViewModel : ObservableObject
|
||||
{
|
||||
private ObservableCollection<ColorListViewModel>? _colorList;
|
||||
@ -160,25 +168,27 @@ public class ColorGroupViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ColorListViewModel : ObservableObject
|
||||
{
|
||||
private ObservableCollection<ColorItemViewModel>? _colors;
|
||||
|
||||
private string? _desc;
|
||||
|
||||
private string? _title;
|
||||
|
||||
public ObservableCollection<ColorItemViewModel>? Colors
|
||||
{
|
||||
get => _colors;
|
||||
set => SetProperty(ref _colors, value);
|
||||
}
|
||||
|
||||
private string? _title;
|
||||
|
||||
public string? Title
|
||||
{
|
||||
get => _title;
|
||||
set => SetProperty(ref _title, value);
|
||||
}
|
||||
|
||||
private string? _desc;
|
||||
public string? Desc
|
||||
{
|
||||
get => _desc;
|
||||
@ -186,49 +196,49 @@ public class ColorListViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ColorItemViewModel : ObservableObject
|
||||
{
|
||||
private IBrush _brush = null!;
|
||||
|
||||
private string _colorDisplayName = null!;
|
||||
|
||||
private string _hex = null!;
|
||||
|
||||
private IBrush _textBrush = null!;
|
||||
|
||||
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, bool light, int index)
|
||||
{
|
||||
ColorDisplayName = colorDisplayName;
|
||||
Brush = brush;
|
||||
Hex = brush.ToString()!.ToUpperInvariant();
|
||||
if ((light && index < 5) || (!light && index >= 5))
|
||||
TextBrush = Brushes.Black;
|
||||
else
|
||||
TextBrush = Brushes.White;
|
||||
}
|
||||
|
||||
public IBrush Brush
|
||||
{
|
||||
get => _brush;
|
||||
set => SetProperty(ref _brush, value);
|
||||
}
|
||||
|
||||
private IBrush _textBrush = null!;
|
||||
|
||||
public IBrush TextBrush
|
||||
{
|
||||
get => _textBrush;
|
||||
set => SetProperty(ref _textBrush, value);
|
||||
}
|
||||
|
||||
private string _colorDisplayName = null!;
|
||||
|
||||
public string ColorDisplayName
|
||||
{
|
||||
get => _colorDisplayName;
|
||||
set => SetProperty(ref _colorDisplayName, value);
|
||||
}
|
||||
|
||||
private string _hex = null!;
|
||||
|
||||
public string Hex
|
||||
{
|
||||
get => _hex;
|
||||
set => SetProperty(ref _hex, value);
|
||||
}
|
||||
|
||||
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, bool light, int index)
|
||||
{
|
||||
ColorDisplayName = colorDisplayName;
|
||||
Brush = brush;
|
||||
Hex = brush.ToString()!.ToUpperInvariant();
|
||||
if ((light && index < 5) || (!light && index >= 5)) {
|
||||
TextBrush = Brushes.Black;
|
||||
} else {
|
||||
TextBrush = Brushes.White;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,58 +7,56 @@ namespace AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
public class IconInfoItemModel : ObservableObject
|
||||
{
|
||||
private string _iconKind = null!;
|
||||
private string _iconName = null!;
|
||||
|
||||
public IconInfoItemModel(string iconName, string iconKind)
|
||||
{
|
||||
IconName = iconName;
|
||||
IconKind = iconKind;
|
||||
}
|
||||
|
||||
public string IconName
|
||||
{
|
||||
get => _iconName;
|
||||
set => SetProperty(ref _iconName, value);
|
||||
}
|
||||
|
||||
private string _iconKind = null!;
|
||||
|
||||
public string IconKind
|
||||
{
|
||||
get => _iconKind;
|
||||
set => SetProperty(ref _iconKind, value);
|
||||
}
|
||||
|
||||
public IconInfoItemModel(string iconName, string iconKind)
|
||||
{
|
||||
IconName = iconName;
|
||||
IconKind = iconKind;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class IconGalleryModel : ObservableObject
|
||||
{
|
||||
private IconThemeType? _iconThemeType;
|
||||
private readonly IconThemeType? _iconThemeType;
|
||||
|
||||
private ObservableCollection<IconInfoItemModel>? _iconInfos;
|
||||
|
||||
public IconGalleryModel(IconThemeType? iconThemeType = null)
|
||||
{
|
||||
_iconThemeType = iconThemeType;
|
||||
if (_iconThemeType.HasValue) LoadThemeIcons(_iconThemeType.Value);
|
||||
}
|
||||
|
||||
public ObservableCollection<IconInfoItemModel>? IconInfos
|
||||
{
|
||||
get => _iconInfos;
|
||||
set => SetProperty(ref _iconInfos, value);
|
||||
}
|
||||
|
||||
public IconGalleryModel(IconThemeType? iconThemeType = null)
|
||||
{
|
||||
_iconThemeType = iconThemeType;
|
||||
if (_iconThemeType.HasValue) {
|
||||
LoadThemeIcons(_iconThemeType.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadThemeIcons(IconThemeType iconThemeType)
|
||||
{
|
||||
var iconPackage = IconManager.Current.GetIconProvider<AntDesignIconPackage>();
|
||||
if (iconPackage is null) {
|
||||
return;
|
||||
}
|
||||
if (iconPackage is null) return;
|
||||
|
||||
IconInfos = new ObservableCollection<IconInfoItemModel>();
|
||||
var iconInfos = iconPackage.GetIconInfos(iconThemeType);
|
||||
foreach (var iconInfo in iconInfos) {
|
||||
foreach (var iconInfo in iconInfos)
|
||||
{
|
||||
var iconInfoModel = new IconInfoItemModel(iconInfo.Name, iconInfo.Name);
|
||||
IconInfos.Add(iconInfoModel);
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AtomUI.Demo.Desktop.ViewModels;
|
||||
|
||||
public class TabControlDemoViewModel: ObservableObject
|
||||
public class TabControlDemoViewModel : ObservableObject
|
||||
{
|
||||
public ObservableCollection<string> Items { get; set; }
|
||||
|
||||
public TabControlDemoViewModel()
|
||||
{
|
||||
Items = new ObservableCollection<string>(Enumerable.Range(1, 200).Select(a => "Tab " + a));
|
||||
}
|
||||
|
||||
public ObservableCollection<string> Items { get; set; }
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build\Nuget.props" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build\Nuget.props"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>AtomUI</RootNamespace>
|
||||
@ -9,12 +9,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia"/>
|
||||
<PackageReference Include="System.Reactive" />
|
||||
<PackageReference Include="System.Reactive"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="AtomUI" />
|
||||
<InternalsVisibleTo Include="AtomUI.Controls" />
|
||||
<InternalsVisibleTo Include="AtomUI"/>
|
||||
<InternalsVisibleTo Include="AtomUI.Controls"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -11,15 +11,17 @@ public enum TextDecorationLine
|
||||
LineThrough
|
||||
}
|
||||
|
||||
|
||||
public enum LineStyle
|
||||
{
|
||||
Solid,
|
||||
Double,
|
||||
Dotted,
|
||||
Dashed,
|
||||
Wavy,
|
||||
Wavy
|
||||
}
|
||||
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
Left,
|
||||
@ -28,6 +30,7 @@ public enum Direction
|
||||
Bottom
|
||||
}
|
||||
|
||||
|
||||
public enum Corner
|
||||
{
|
||||
None = 0x00,
|
||||
@ -38,6 +41,7 @@ public enum Corner
|
||||
All = TopLeft | TopRight | BottomLeft | BottomRight
|
||||
}
|
||||
|
||||
|
||||
public enum SizeType
|
||||
{
|
||||
Large,
|
||||
@ -45,6 +49,7 @@ public enum SizeType
|
||||
Small
|
||||
}
|
||||
|
||||
|
||||
// 文本修饰信息定义
|
||||
// 类似 CSS text-decoration
|
||||
public class TextDecorationInfo
|
||||
@ -55,6 +60,7 @@ public class TextDecorationInfo
|
||||
public int Thickness { get; set; } = 1;
|
||||
}
|
||||
|
||||
|
||||
public enum ColorNameFormat
|
||||
{
|
||||
HexRgb,
|
||||
|
@ -11,17 +11,13 @@ public static class BindUtils
|
||||
{
|
||||
targetProperty ??= sourceProperty;
|
||||
var registry = AvaloniaPropertyRegistry.Instance;
|
||||
if (!sourceProperty.IsAttached) {
|
||||
if (!registry.IsRegistered(source.GetType(), sourceProperty)) {
|
||||
if (!sourceProperty.IsAttached)
|
||||
if (!registry.IsRegistered(source.GetType(), sourceProperty))
|
||||
throw new ArgumentException($"Relay source property is not registered for: {source.GetType().Name}.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetProperty.IsAttached) {
|
||||
if (!registry.IsRegistered(target.GetType(), targetProperty)) {
|
||||
if (!targetProperty.IsAttached)
|
||||
if (!registry.IsRegistered(target.GetType(), targetProperty))
|
||||
throw new ArgumentException($"Relay target property is not registered for: {target.GetType().Name}.");
|
||||
}
|
||||
}
|
||||
|
||||
var descriptor = new IndexerDescriptor
|
||||
{
|
||||
@ -33,19 +29,18 @@ public static class BindUtils
|
||||
return target.Bind(targetProperty, descriptor);
|
||||
}
|
||||
|
||||
public static IDisposable RelayBind<TSource, TResult>(AvaloniaObject source, AvaloniaProperty<TSource> sourceProperty,
|
||||
public static IDisposable RelayBind<TSource, TResult>(AvaloniaObject source,
|
||||
AvaloniaProperty<TSource> sourceProperty,
|
||||
AvaloniaObject target, AvaloniaProperty<TResult> targetProperty,
|
||||
Func<TSource, TResult> converter,
|
||||
BindingPriority priority = BindingPriority.Template)
|
||||
{
|
||||
var registry = AvaloniaPropertyRegistry.Instance;
|
||||
if (!registry.IsRegistered(source.GetType(), sourceProperty)) {
|
||||
if (!registry.IsRegistered(source.GetType(), sourceProperty))
|
||||
throw new ArgumentException($"Relay source property is not registered for: {source.GetType().Name}.");
|
||||
}
|
||||
|
||||
if (!registry.IsRegistered(target.GetType(), targetProperty)) {
|
||||
if (!registry.IsRegistered(target.GetType(), targetProperty))
|
||||
throw new ArgumentException($"Relay target property is not registered for: {target.GetType().Name}.");
|
||||
}
|
||||
|
||||
return target.Bind(targetProperty, source.GetObservable(sourceProperty, converter), priority);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ internal static class XYFocusHelpers
|
||||
this InputElement visual,
|
||||
KeyDeviceType? keyDeviceType)
|
||||
{
|
||||
return XYFocusHelpers.IsAllowedXYNavigationMode(XYFocus.GetNavigationModes(visual), keyDeviceType);
|
||||
return IsAllowedXYNavigationMode(XYFocus.GetNavigationModes(visual), keyDeviceType);
|
||||
}
|
||||
|
||||
private static bool IsAllowedXYNavigationMode(
|
||||
@ -16,15 +16,16 @@ internal static class XYFocusHelpers
|
||||
KeyDeviceType? keyDeviceType)
|
||||
{
|
||||
if (!keyDeviceType.HasValue) return true;
|
||||
switch (keyDeviceType.GetValueOrDefault()) {
|
||||
switch (keyDeviceType.GetValueOrDefault())
|
||||
{
|
||||
case KeyDeviceType.Keyboard:
|
||||
return modes.HasFlag((Enum)XYFocusNavigationModes.Keyboard);
|
||||
return modes.HasFlag(XYFocusNavigationModes.Keyboard);
|
||||
case KeyDeviceType.Gamepad:
|
||||
return modes.HasFlag((Enum)XYFocusNavigationModes.Gamepad);
|
||||
return modes.HasFlag(XYFocusNavigationModes.Gamepad);
|
||||
case KeyDeviceType.Remote:
|
||||
return modes.HasFlag((Enum)XYFocusNavigationModes.Remote);
|
||||
return modes.HasFlag(XYFocusNavigationModes.Remote);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(keyDeviceType), (object)keyDeviceType, (string?)null);
|
||||
throw new ArgumentOutOfRangeException(nameof(keyDeviceType), keyDeviceType, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,18 +6,19 @@ using Avalonia.VisualTree;
|
||||
|
||||
namespace AtomUI.Input;
|
||||
|
||||
class TransformTrackingHelper : IDisposable
|
||||
internal class TransformTrackingHelper : IDisposable
|
||||
{
|
||||
private Visual? _visual;
|
||||
private bool _queuedForUpdate;
|
||||
private readonly EventHandler<AvaloniaPropertyChangedEventArgs> _propertyChangedHandler;
|
||||
private readonly List<Visual> _propertyChangedSubscriptions = new List<Visual>();
|
||||
private static readonly FieldInfo AfterRenderFieldInfo;
|
||||
private readonly EventHandler<AvaloniaPropertyChangedEventArgs> _propertyChangedHandler;
|
||||
private readonly List<Visual> _propertyChangedSubscriptions = new();
|
||||
private bool _queuedForUpdate;
|
||||
private Visual? _visual;
|
||||
|
||||
static TransformTrackingHelper()
|
||||
{
|
||||
AfterRenderFieldInfo =
|
||||
typeof(DispatcherPriority).GetFieldInfoOrThrow("AfterRender", BindingFlags.Static | BindingFlags.NonPublic)!;
|
||||
typeof(DispatcherPriority).GetFieldInfoOrThrow("AfterRender",
|
||||
BindingFlags.Static | BindingFlags.NonPublic)!;
|
||||
}
|
||||
|
||||
public TransformTrackingHelper()
|
||||
@ -25,29 +26,11 @@ class TransformTrackingHelper : IDisposable
|
||||
_propertyChangedHandler = PropertyChangedHandler;
|
||||
}
|
||||
|
||||
public void SetVisual(Visual? visual)
|
||||
{
|
||||
Dispose();
|
||||
_visual = visual;
|
||||
if (visual != null) {
|
||||
visual.AttachedToVisualTree += OnAttachedToVisualTree;
|
||||
visual.DetachedFromVisualTree -= OnDetachedFromVisualTree;
|
||||
if (visual.GetVisualRoot() is not null) {
|
||||
SubscribeToParents();
|
||||
}
|
||||
|
||||
UpdateMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix? Matrix { get; private set; }
|
||||
public event Action? MatrixChanged;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_visual == null) {
|
||||
return;
|
||||
}
|
||||
if (_visual == null) return;
|
||||
|
||||
UnsubscribeFromParents();
|
||||
_visual.AttachedToVisualTree -= OnAttachedToVisualTree;
|
||||
@ -55,13 +38,32 @@ class TransformTrackingHelper : IDisposable
|
||||
_visual = null;
|
||||
}
|
||||
|
||||
public void SetVisual(Visual? visual)
|
||||
{
|
||||
Dispose();
|
||||
_visual = visual;
|
||||
if (visual != null)
|
||||
{
|
||||
visual.AttachedToVisualTree += OnAttachedToVisualTree;
|
||||
visual.DetachedFromVisualTree -= OnDetachedFromVisualTree;
|
||||
if (visual.GetVisualRoot() is not null) SubscribeToParents();
|
||||
|
||||
UpdateMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public event Action? MatrixChanged;
|
||||
|
||||
private void SubscribeToParents()
|
||||
{
|
||||
var visual = _visual;
|
||||
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
// false positive
|
||||
while (visual != null) {
|
||||
if (visual is Visual v) {
|
||||
while (visual != null)
|
||||
{
|
||||
if (visual is Visual v)
|
||||
{
|
||||
v.PropertyChanged += _propertyChangedHandler;
|
||||
_propertyChangedSubscriptions.Add(v);
|
||||
}
|
||||
@ -76,14 +78,14 @@ class TransformTrackingHelper : IDisposable
|
||||
_propertyChangedSubscriptions.Clear();
|
||||
}
|
||||
|
||||
void UpdateMatrix()
|
||||
private void UpdateMatrix()
|
||||
{
|
||||
Matrix? matrix = null;
|
||||
if (_visual != null && _visual.GetVisualRoot() != null) {
|
||||
if (_visual != null && _visual.GetVisualRoot() != null)
|
||||
matrix = _visual.TransformToVisual((Visual)_visual.GetVisualRoot()!);
|
||||
}
|
||||
|
||||
if (Matrix != matrix) {
|
||||
if (Matrix != matrix)
|
||||
{
|
||||
Matrix = matrix;
|
||||
MatrixChanged?.Invoke();
|
||||
}
|
||||
@ -97,9 +99,7 @@ class TransformTrackingHelper : IDisposable
|
||||
|
||||
private void EnqueueForUpdate()
|
||||
{
|
||||
if (_queuedForUpdate) {
|
||||
return;
|
||||
}
|
||||
if (_queuedForUpdate) return;
|
||||
|
||||
_queuedForUpdate = true;
|
||||
var priority = (DispatcherPriority)AfterRenderFieldInfo.GetValue(null)!;
|
||||
@ -109,9 +109,7 @@ class TransformTrackingHelper : IDisposable
|
||||
private void PropertyChangedHandler(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
e.TryGetProperty<bool>("IsEffectiveValueChange", out var isEffectiveValueChange);
|
||||
if (isEffectiveValueChange && e.Property == Visual.BoundsProperty) {
|
||||
EnqueueForUpdate();
|
||||
}
|
||||
if (isEffectiveValueChange && e.Property == Visual.BoundsProperty) EnqueueForUpdate();
|
||||
}
|
||||
|
||||
private void OnDetachedFromVisualTree(object? sender, VisualTreeAttachmentEventArgs visualTreeAttachmentEventArgs)
|
||||
|
@ -26,7 +26,8 @@ public static class BoxShadowExtensions
|
||||
double topThickness = 0;
|
||||
double rightThickness = 0;
|
||||
double bottomThickness = 0;
|
||||
foreach (var shadow in boxShadows) {
|
||||
foreach (var shadow in boxShadows)
|
||||
{
|
||||
var thickness = shadow.Thickness();
|
||||
leftThickness = Math.Max(leftThickness, thickness.Left);
|
||||
topThickness = Math.Max(topThickness, thickness.Top);
|
||||
|
@ -28,20 +28,22 @@ public static class ColorExtensions
|
||||
|
||||
public static string HexName(this Color color, ColorNameFormat format = ColorNameFormat.HexRgb)
|
||||
{
|
||||
uint rgb = color.ToUInt32();
|
||||
string formatStr = "x8";
|
||||
if (format == ColorNameFormat.HexRgb) {
|
||||
var rgb = color.ToUInt32();
|
||||
var formatStr = "x8";
|
||||
if (format == ColorNameFormat.HexRgb)
|
||||
{
|
||||
formatStr = "x6";
|
||||
rgb &= 0xFFFFFF;
|
||||
}
|
||||
|
||||
return $"#{rgb.ToString(formatStr, CultureInfo.InvariantCulture)}";
|
||||
}
|
||||
|
||||
public static Color Desaturate(this Color color, int amount = 10)
|
||||
{
|
||||
amount = Math.Clamp(amount, 0, 100);
|
||||
HslColor hslColor = color.ToHsl();
|
||||
double s = hslColor.S;
|
||||
var hslColor = color.ToHsl();
|
||||
var s = hslColor.S;
|
||||
s -= amount / 100d;
|
||||
s = Math.Clamp(s, 0d, 1d);
|
||||
return HslColor.FromHsl(hslColor.H, s, hslColor.L).ToRgb();
|
||||
@ -50,8 +52,8 @@ public static class ColorExtensions
|
||||
public static Color Saturate(this Color color, int amount = 10)
|
||||
{
|
||||
amount = Math.Clamp(amount, 0, 100);
|
||||
HslColor hslColor = color.ToHsl();
|
||||
double s = hslColor.S;
|
||||
var hslColor = color.ToHsl();
|
||||
var s = hslColor.S;
|
||||
s += amount / 100d;
|
||||
s = Math.Clamp(s, 0d, 1d);
|
||||
return HslColor.FromHsl(hslColor.H, s, hslColor.L).ToRgb();
|
||||
@ -65,8 +67,8 @@ public static class ColorExtensions
|
||||
public static Color Lighten(this Color color, int amount = 10)
|
||||
{
|
||||
amount = Math.Clamp(amount, 0, 100);
|
||||
HslColor hslColor = color.ToHsl();
|
||||
double l = hslColor.L;
|
||||
var hslColor = color.ToHsl();
|
||||
var l = hslColor.L;
|
||||
l += amount / 100d;
|
||||
l = Math.Clamp(l, 0d, 1d);
|
||||
Console.WriteLine(hslColor.H);
|
||||
@ -79,7 +81,7 @@ public static class ColorExtensions
|
||||
int r = color.R;
|
||||
int g = color.G;
|
||||
int b = color.B;
|
||||
int delta = (int)Math.Round(255d * -(amount / 100d));
|
||||
var delta = (int)Math.Round(255d * -(amount / 100d));
|
||||
r = Math.Max(0, Math.Min(255, r - delta));
|
||||
g = Math.Max(0, Math.Min(255, g - delta));
|
||||
b = Math.Max(0, Math.Min(255, b - delta));
|
||||
@ -89,8 +91,8 @@ public static class ColorExtensions
|
||||
public static Color Darken(this Color color, int amount = 10)
|
||||
{
|
||||
amount = Math.Clamp(amount, 0, 100);
|
||||
HslColor hslColor = color.ToHsl();
|
||||
double l = hslColor.L;
|
||||
var hslColor = color.ToHsl();
|
||||
var l = hslColor.L;
|
||||
l -= amount / 100d;
|
||||
l = Math.Clamp(l, 0d, 1d);
|
||||
return HslColor.FromHsl(hslColor.H, hslColor.S, l).ToRgb();
|
||||
@ -98,8 +100,8 @@ public static class ColorExtensions
|
||||
|
||||
public static Color Spin(this Color color, int amount = 10)
|
||||
{
|
||||
HslColor hslColor = color.ToHsl();
|
||||
double h = hslColor.H;
|
||||
var hslColor = color.ToHsl();
|
||||
var h = hslColor.H;
|
||||
h = (h + amount) % 360;
|
||||
h = h < 0 ? 360 + h : h;
|
||||
return HslColor.FromHsl(h, hslColor.S, hslColor.L).ToRgb();
|
||||
@ -128,25 +130,25 @@ public static class ColorExtensions
|
||||
double r = 0;
|
||||
double g = 0;
|
||||
double b = 0;
|
||||
if (MathUtils.LessThanOrClose(rsRGB, 0.03928)) {
|
||||
if (MathUtils.LessThanOrClose(rsRGB, 0.03928))
|
||||
r = rsRGB / 12.92;
|
||||
} else {
|
||||
else
|
||||
|
||||
// eslint-disable-next-line prefer-exponentiation-operator
|
||||
r = Math.Pow((rsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
if (gsRGB <= 0.03928) {
|
||||
if (gsRGB <= 0.03928)
|
||||
g = gsRGB / 12.92;
|
||||
} else {
|
||||
else
|
||||
|
||||
// eslint-disable-next-line prefer-exponentiation-operator
|
||||
g = Math.Pow((gsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
if (bsRGB <= 0.03928) {
|
||||
if (bsRGB <= 0.03928)
|
||||
b = bsRGB / 12.92;
|
||||
} else {
|
||||
else
|
||||
|
||||
// eslint-disable-next-line prefer-exponentiation-operator
|
||||
b = Math.Pow((bsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
}
|
||||
|
@ -9,23 +9,27 @@ public enum WCAG2Level
|
||||
AAA
|
||||
}
|
||||
|
||||
|
||||
public enum WCAG2Size
|
||||
{
|
||||
Large,
|
||||
Small
|
||||
}
|
||||
|
||||
|
||||
public class WCAG2Parms
|
||||
{
|
||||
public WCAG2Level Level { get; set; } = WCAG2Level.AA;
|
||||
public WCAG2Size Size { get; set; } = WCAG2Size.Small;
|
||||
}
|
||||
|
||||
|
||||
public class WCAG2FallbackParms : WCAG2Parms
|
||||
{
|
||||
public bool IncludeFallbackColors { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public static class ColorUtils
|
||||
{
|
||||
public static Color FromRgbF(double alpha, double red, double green, double blue)
|
||||
@ -78,24 +82,24 @@ public static class ColorUtils
|
||||
|
||||
public static Color OnBackground(in Color frontColor, in Color backgroundColor)
|
||||
{
|
||||
double fr = frontColor.GetRedF();
|
||||
double fg = frontColor.GetGreenF();
|
||||
double fb = frontColor.GetBlueF();
|
||||
double fa = frontColor.GetAlphaF();
|
||||
var fr = frontColor.GetRedF();
|
||||
var fg = frontColor.GetGreenF();
|
||||
var fb = frontColor.GetBlueF();
|
||||
var fa = frontColor.GetAlphaF();
|
||||
|
||||
double br = backgroundColor.GetRedF();
|
||||
double bg = backgroundColor.GetGreenF();
|
||||
double bb = backgroundColor.GetBlueF();
|
||||
double ba = backgroundColor.GetAlphaF();
|
||||
var br = backgroundColor.GetRedF();
|
||||
var bg = backgroundColor.GetGreenF();
|
||||
var bb = backgroundColor.GetBlueF();
|
||||
var ba = backgroundColor.GetAlphaF();
|
||||
|
||||
double alpha = fa + ba * (1 - fa);
|
||||
var alpha = fa + ba * (1 - fa);
|
||||
|
||||
double nr = (fr * fa + br * ba * (1 - fa)) / alpha;
|
||||
double ng = (fg * fa + bg * ba * (1 - fa)) / alpha;
|
||||
double nb = (fb * fa + bb * ba * (1 - fa)) / alpha;
|
||||
double na = alpha;
|
||||
var nr = (fr * fa + br * ba * (1 - fa)) / alpha;
|
||||
var ng = (fg * fa + bg * ba * (1 - fa)) / alpha;
|
||||
var nb = (fb * fa + bb * ba * (1 - fa)) / alpha;
|
||||
var na = alpha;
|
||||
|
||||
return ColorUtils.FromRgbF(na, nr, ng, nb);
|
||||
return FromRgbF(na, nr, ng, nb);
|
||||
}
|
||||
|
||||
public static bool IsStableColor(int color)
|
||||
@ -115,87 +119,73 @@ public static class ColorUtils
|
||||
|
||||
public static Color AlphaColor(in Color frontColor, in Color backgroundColor)
|
||||
{
|
||||
double fR = frontColor.GetRedF();
|
||||
double fG = frontColor.GetGreenF();
|
||||
double fB = frontColor.GetBlueF();
|
||||
double originAlpha = frontColor.GetAlphaF();
|
||||
if (originAlpha < 1d) {
|
||||
return frontColor;
|
||||
}
|
||||
var fR = frontColor.GetRedF();
|
||||
var fG = frontColor.GetGreenF();
|
||||
var fB = frontColor.GetBlueF();
|
||||
var originAlpha = frontColor.GetAlphaF();
|
||||
if (originAlpha < 1d) return frontColor;
|
||||
|
||||
double bR = backgroundColor.GetRedF();
|
||||
double bG = backgroundColor.GetGreenF();
|
||||
double bB = backgroundColor.GetBlueF();
|
||||
var bR = backgroundColor.GetRedF();
|
||||
var bG = backgroundColor.GetGreenF();
|
||||
var bB = backgroundColor.GetBlueF();
|
||||
|
||||
for (var fA = 0.01d; fA <= 1.0d; fA += 0.01d) {
|
||||
double r = Math.Round((fR - bR * (1d - fA)) / fA);
|
||||
double g = Math.Round((fG - bG * (1d - fA)) / fA);
|
||||
double b = Math.Round((fB - bB * (1d - fA)) / fA);
|
||||
if (IsStableColor(r) && IsStableColor(g) && IsStableColor(b)) {
|
||||
return ColorUtils.FromRgbF(Math.Round(fA * 100d) / 100d, r, g, b);
|
||||
}
|
||||
for (var fA = 0.01d; fA <= 1.0d; fA += 0.01d)
|
||||
{
|
||||
var r = Math.Round((fR - bR * (1d - fA)) / fA);
|
||||
var g = Math.Round((fG - bG * (1d - fA)) / fA);
|
||||
var b = Math.Round((fB - bB * (1d - fA)) / fA);
|
||||
if (IsStableColor(r) && IsStableColor(g) && IsStableColor(b))
|
||||
return FromRgbF(Math.Round(fA * 100d) / 100d, r, g, b);
|
||||
}
|
||||
|
||||
// fallback
|
||||
/* istanbul ignore next */
|
||||
return ColorUtils.FromRgbF(1.0d, fR, fG, fB);
|
||||
return FromRgbF(1.0d, fR, fG, fB);
|
||||
}
|
||||
|
||||
public static Color ParseCssRgbColor(string colorExpr)
|
||||
{
|
||||
if (TryParseCssRgbColor(colorExpr, out Color color)) {
|
||||
return color;
|
||||
}
|
||||
if (TryParseCssRgbColor(colorExpr, out var color)) return color;
|
||||
|
||||
throw new FormatException($"Invalid color string: '{colorExpr.ToString()}'.");
|
||||
throw new FormatException($"Invalid color string: '{colorExpr}'.");
|
||||
}
|
||||
|
||||
public static bool TryParseCssRgbColor(string? colorExpr, out Color color)
|
||||
{
|
||||
color = default;
|
||||
if (string.IsNullOrEmpty(colorExpr)) {
|
||||
return false;
|
||||
}
|
||||
if (string.IsNullOrEmpty(colorExpr)) return false;
|
||||
|
||||
if (colorExpr[0] == '#') {
|
||||
return Color.TryParse(colorExpr, out color);
|
||||
}
|
||||
if (colorExpr[0] == '#') return Color.TryParse(colorExpr, out color);
|
||||
|
||||
bool isRgba = colorExpr.StartsWith("rgba", StringComparison.InvariantCultureIgnoreCase);
|
||||
bool isRgb = false;
|
||||
if (!isRgba) {
|
||||
isRgb = colorExpr.StartsWith("rgb", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
var isRgba = colorExpr.StartsWith("rgba", StringComparison.InvariantCultureIgnoreCase);
|
||||
var isRgb = false;
|
||||
if (!isRgba) isRgb = colorExpr.StartsWith("rgb", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
if (isRgb || isRgba) {
|
||||
int leftParen = colorExpr.IndexOf('(');
|
||||
int rightParen = colorExpr.IndexOf(')');
|
||||
if (leftParen == -1 || rightParen == -1) {
|
||||
return false;
|
||||
}
|
||||
if (isRgb || isRgba)
|
||||
{
|
||||
var leftParen = colorExpr.IndexOf('(');
|
||||
var rightParen = colorExpr.IndexOf(')');
|
||||
if (leftParen == -1 || rightParen == -1) return false;
|
||||
|
||||
var parts = new List<string>(colorExpr.Substring(leftParen + 1, rightParen - leftParen - 1)
|
||||
.Split(',', StringSplitOptions.RemoveEmptyEntries));
|
||||
if (isRgb) {
|
||||
if (parts.Count != 3) {
|
||||
return false;
|
||||
}
|
||||
if (isRgb)
|
||||
{
|
||||
if (parts.Count != 3) return false;
|
||||
|
||||
parts.Add("255");
|
||||
} else {
|
||||
if (parts.Count != 4) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts.Count != 4) return false;
|
||||
}
|
||||
|
||||
List<int> rgbaValues = new List<int>();
|
||||
foreach (var part in parts) {
|
||||
if (int.TryParse(part, out int partValue)) {
|
||||
var rgbaValues = new List<int>();
|
||||
foreach (var part in parts)
|
||||
if (int.TryParse(part, out var partValue))
|
||||
rgbaValues.Add(partValue);
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
color = Color.FromArgb((byte)rgbaValues[0], (byte)rgbaValues[1], (byte)rgbaValues[2], (byte)rgbaValues[3]);
|
||||
return true;
|
||||
@ -206,17 +196,17 @@ public static class ColorUtils
|
||||
|
||||
/// Readability Functions
|
||||
/// ---------------------
|
||||
/// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
||||
///
|
||||
/// AKA `contrast`
|
||||
/// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
||||
/// <http:// www.w3.org/ TR/2008/ REC-WCAG20-20081211/# contrast-ratiodef ( WCAG Version 2)
|
||||
/// AKA ` contrast`
|
||||
/// Analyze the 2 colors and returns the color contrast defined by ( WCAG Version
|
||||
/// 2
|
||||
/// )
|
||||
public static double Readability(Color color1, Color color2)
|
||||
{
|
||||
return (Math.Max(color1.GetLuminance(), color2.GetLuminance()) + 0.05) /
|
||||
(Math.Min(color1.GetLuminance(), color2.GetLuminance()) + 0.05);
|
||||
}
|
||||
|
||||
///
|
||||
/// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
||||
/// The third argument is an object.
|
||||
/// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
||||
@ -230,24 +220,23 @@ public static class ColorUtils
|
||||
{
|
||||
wcag2 ??= new WCAG2Parms();
|
||||
var readabilityLevel = Readability(color1, color2);
|
||||
if (wcag2.Level == WCAG2Level.AA) {
|
||||
if (wcag2.Size == WCAG2Size.Large) {
|
||||
return MathUtils.GreaterThanOrClose(readabilityLevel, 3);
|
||||
}
|
||||
if (wcag2.Level == WCAG2Level.AA)
|
||||
{
|
||||
if (wcag2.Size == WCAG2Size.Large) return MathUtils.GreaterThanOrClose(readabilityLevel, 3);
|
||||
|
||||
return MathUtils.GreaterThanOrClose(readabilityLevel, 4.5);
|
||||
} else if (wcag2.Level == WCAG2Level.AAA) {
|
||||
if (wcag2.Size == WCAG2Size.Large) {
|
||||
return MathUtils.GreaterThanOrClose(readabilityLevel, 4.5);
|
||||
}
|
||||
|
||||
if (wcag2.Level == WCAG2Level.AAA)
|
||||
{
|
||||
if (wcag2.Size == WCAG2Size.Large) return MathUtils.GreaterThanOrClose(readabilityLevel, 4.5);
|
||||
|
||||
return MathUtils.GreaterThanOrClose(readabilityLevel, 7);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Given a base color and a list of possible foreground or background
|
||||
/// colors for that base, returns the most readable color.
|
||||
/// Optionally returns Black or White if the most readable color is unreadable.
|
||||
@ -261,32 +250,32 @@ public static class ColorUtils
|
||||
/// new Color().mostReadable('#123', ['#124", "#125'],{ includeFallbackColors: true }).toHexString(); // "#ffffff"
|
||||
/// new Color().mostReadable('#a8015a', ["#faf3f3"], { includeFallbackColors:true, level: 'AAA', size: 'large' }).toHexString(); // "#faf3f3"
|
||||
/// new Color().mostReadable('#a8015a', ["#faf3f3"], { includeFallbackColors:true, level: 'AAA', size: 'small' }).toHexString(); // "#ffffff"
|
||||
///
|
||||
public static Color? MostReadable(Color baseColor, List<Color> colorList, WCAG2FallbackParms? args = null)
|
||||
{
|
||||
args ??= new WCAG2FallbackParms()
|
||||
args ??= new WCAG2FallbackParms
|
||||
{
|
||||
IncludeFallbackColors = false,
|
||||
Level = WCAG2Level.AA,
|
||||
Size = WCAG2Size.Small
|
||||
};
|
||||
Color? bestColor = null;
|
||||
double bestScore = 0d;
|
||||
foreach (var color in colorList) {
|
||||
var bestScore = 0d;
|
||||
foreach (var color in colorList)
|
||||
{
|
||||
var score = Readability(baseColor, color);
|
||||
if (score > bestScore) {
|
||||
if (score > bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
bestColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsReadable(baseColor, bestColor!.Value, new WCAG2Parms() { Level = args.Level, Size = args.Size }) ||
|
||||
!args.IncludeFallbackColors) {
|
||||
if (IsReadable(baseColor, bestColor!.Value, new WCAG2Parms { Level = args.Level, Size = args.Size }) ||
|
||||
!args.IncludeFallbackColors)
|
||||
return bestColor;
|
||||
}
|
||||
|
||||
args.IncludeFallbackColors = false;
|
||||
return MostReadable(baseColor, new List<Color>()
|
||||
return MostReadable(baseColor, new List<Color>
|
||||
{
|
||||
Color.Parse("#fff"),
|
||||
Color.Parse("#000")
|
||||
|
@ -33,9 +33,7 @@ public static class CommonShapeBuilder
|
||||
/// <returns></returns>
|
||||
public static Geometry BuildArc(Rect rect, double startAngle, double sweepAngle)
|
||||
{
|
||||
if (MathUtils.IsZero(sweepAngle)) {
|
||||
return new StreamGeometry();
|
||||
}
|
||||
if (MathUtils.IsZero(sweepAngle)) return new StreamGeometry();
|
||||
|
||||
var angle1 = MathUtilities.Deg2Rad(startAngle);
|
||||
var angle2 = angle1 + MathUtilities.Deg2Rad(sweepAngle);
|
||||
@ -46,10 +44,10 @@ public static class CommonShapeBuilder
|
||||
var normStart = RadToNormRad(startAngle);
|
||||
var normEnd = RadToNormRad(sweepAngle);
|
||||
|
||||
if (MathUtils.AreClose(normStart, normEnd) && !MathUtils.AreClose(startAngle, sweepAngle)) {
|
||||
if (MathUtils.AreClose(normStart, normEnd) && !MathUtils.AreClose(startAngle, sweepAngle))
|
||||
|
||||
// Complete ring.
|
||||
return new EllipseGeometry(rect);
|
||||
}
|
||||
|
||||
// Partial arc.
|
||||
var deflatedRect = rect;
|
||||
@ -67,13 +65,14 @@ public static class CommonShapeBuilder
|
||||
|
||||
var arcGeometry = new StreamGeometry();
|
||||
|
||||
using (StreamGeometryContext context = arcGeometry.Open()) {
|
||||
using (var context = arcGeometry.Open())
|
||||
{
|
||||
context.BeginFigure(startPoint, false);
|
||||
context.ArcTo(
|
||||
endPoint,
|
||||
new Size(radiusX, radiusY),
|
||||
rotationAngle: angleGap,
|
||||
isLargeArc: angleGap >= Math.PI,
|
||||
angleGap,
|
||||
angleGap >= Math.PI,
|
||||
SweepDirection.Clockwise);
|
||||
context.EndFigure(false);
|
||||
}
|
||||
@ -81,9 +80,15 @@ public static class CommonShapeBuilder
|
||||
return arcGeometry;
|
||||
}
|
||||
|
||||
private static double RadToNormRad(double inAngle) => ((inAngle % (Math.PI * 2)) + (Math.PI * 2)) % (Math.PI * 2);
|
||||
private static Point GetRingPoint(double radiusX, double radiusY, double centerX, double centerY, double angle) =>
|
||||
new Point((radiusX * Math.Cos(angle)) + centerX, (radiusY * Math.Sin(angle)) + centerY);
|
||||
private static double RadToNormRad(double inAngle)
|
||||
{
|
||||
return (inAngle % (Math.PI * 2) + Math.PI * 2) % (Math.PI * 2);
|
||||
}
|
||||
|
||||
private static Point GetRingPoint(double radiusX, double radiusY, double centerX, double centerY, double angle)
|
||||
{
|
||||
return new Point(radiusX * Math.Cos(angle) + centerX, radiusY * Math.Sin(angle) + centerY);
|
||||
}
|
||||
|
||||
public static Geometry BuildArrow(double size, double radius)
|
||||
{
|
||||
@ -94,16 +99,22 @@ public static class CommonShapeBuilder
|
||||
var p1 = new Point(size / 2.0, size / 2.0 + 1);
|
||||
var p2 = new Point(0, size);
|
||||
var p3 = new Point(size, size);
|
||||
|
||||
// 假设 r 是圆角的半径
|
||||
var controlPoint = new Point(p1.X, p1.Y - radius);
|
||||
|
||||
// 移动到调整后的底边左顶点
|
||||
context.BeginFigure(p2, true);
|
||||
|
||||
// 绘制左边的直线到圆角的起始点
|
||||
context.LineTo(new Point(p1.X - radius, p1.Y));
|
||||
|
||||
// 绘制圆角
|
||||
context.QuadraticBezierTo(controlPoint, new Point(p1.X + radius, p1.Y));
|
||||
|
||||
// 绘制右边的直线到调整后的底边右顶点
|
||||
context.LineTo(p3);
|
||||
|
||||
// 绘制底边,闭合路径
|
||||
context.LineTo(p2);
|
||||
context.EndFigure(true);
|
||||
|
@ -11,11 +11,10 @@ public static class DrawingContextExtensions
|
||||
BoxShadows boxShadows = default)
|
||||
{
|
||||
double pillRadius;
|
||||
if (orientation == Orientation.Horizontal) {
|
||||
if (orientation == Orientation.Horizontal)
|
||||
pillRadius = rect.Height / 2;
|
||||
} else {
|
||||
else
|
||||
pillRadius = rect.Width / 2;
|
||||
}
|
||||
context.DrawRectangle(brush, pen, rect, pillRadius, pillRadius, boxShadows);
|
||||
}
|
||||
|
||||
|
@ -7,36 +7,36 @@ public static class GeometryUtils
|
||||
public static Rect CalculateScaledRect(in Rect rect, double scaleFactorX, double scaleFactorY, in Point origin)
|
||||
{
|
||||
// 计算原点相对于矩形左上角的偏移量
|
||||
double originalOffsetX = origin.X - rect.X;
|
||||
double originalOffsetY = origin.Y - rect.Y;
|
||||
var originalOffsetX = origin.X - rect.X;
|
||||
var originalOffsetY = origin.Y - rect.Y;
|
||||
|
||||
// 计算缩放后的偏移量
|
||||
double scaledOffsetX = originalOffsetX * scaleFactorX;
|
||||
double scaledOffsetY = originalOffsetY * scaleFactorY;
|
||||
var scaledOffsetX = originalOffsetX * scaleFactorX;
|
||||
var scaledOffsetY = originalOffsetY * scaleFactorY;
|
||||
|
||||
// 计算偏移量的变化
|
||||
double offsetXChange = scaledOffsetX - originalOffsetX;
|
||||
double offsetYChange = scaledOffsetY - originalOffsetY;
|
||||
var offsetXChange = scaledOffsetX - originalOffsetX;
|
||||
var offsetYChange = scaledOffsetY - originalOffsetY;
|
||||
|
||||
// 计算新的矩形位置
|
||||
double newX = rect.X - offsetXChange;
|
||||
double newY = rect.Y - offsetYChange;
|
||||
var newX = rect.X - offsetXChange;
|
||||
var newY = rect.Y - offsetYChange;
|
||||
|
||||
// 计算新的矩形宽度和高度
|
||||
double newWidth = rect.Width * scaleFactorX;
|
||||
double newHeight = rect.Height * scaleFactorY;
|
||||
var newWidth = rect.Width * scaleFactorX;
|
||||
var newHeight = rect.Height * scaleFactorY;
|
||||
|
||||
return new Rect(newX, newY, newWidth, newHeight);
|
||||
}
|
||||
|
||||
public static double CornerRadiusScalarValue(CornerRadius cornerRadius, bool maxWhenNotUniform = true)
|
||||
{
|
||||
if (cornerRadius.IsUniform) {
|
||||
return cornerRadius.TopLeft;
|
||||
}
|
||||
if (cornerRadius.IsUniform) return cornerRadius.TopLeft;
|
||||
|
||||
return maxWhenNotUniform
|
||||
? Math.Max(cornerRadius.TopLeft, Math.Max(cornerRadius.TopRight, Math.Max(cornerRadius.BottomLeft, cornerRadius.BottomRight)))
|
||||
: Math.Min(cornerRadius.TopLeft, Math.Min(cornerRadius.TopRight, Math.Min(cornerRadius.BottomLeft, cornerRadius.BottomRight)));
|
||||
? Math.Max(cornerRadius.TopLeft,
|
||||
Math.Max(cornerRadius.TopRight, Math.Max(cornerRadius.BottomLeft, cornerRadius.BottomRight)))
|
||||
: Math.Min(cornerRadius.TopLeft,
|
||||
Math.Min(cornerRadius.TopRight, Math.Min(cornerRadius.BottomLeft, cornerRadius.BottomRight)));
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user