* 格式化代码;

This commit is contained in:
zeroone 2024-09-10 00:09:07 +08:00
parent 480a9be15c
commit 80638627ee
541 changed files with 52446 additions and 50656 deletions

View File

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

View File

@ -2,7 +2,7 @@
<!-- https://github.com/dotnet/sdk/issues/22515-->
<ItemGroup>
<None Remove="*.csproj.DotSettings" />
<None Remove="*.csproj.DotSettings"/>
</ItemGroup>
</Project>

View File

@ -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()
{

View File

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

View File

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

View File

@ -1,61 +1,65 @@
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;
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
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()
{
Title = Title,
TitlePosition = AtomUI.Controls.SeparatorTitlePosition.Left,
FontWeight = FontWeight.Bold,
};
private void SetupUi()
{
var mainLayout = new StackPanel();
var showCaseTitle = new Separator
{
Title = Title,
TitlePosition = SeparatorTitlePosition.Left,
FontWeight = FontWeight.Bold
};
if (Content is Control contentControl) {
LogicalChildren.Remove(contentControl);
mainLayout.Children.Add(contentControl);
}
if (Content is Control contentControl)
{
LogicalChildren.Remove(contentControl);
mainLayout.Children.Add(contentControl);
}
mainLayout.Children.Add(new Border
{
Height = 10,
Background = Brushes.Transparent
});
mainLayout.Children.Add(showCaseTitle);
mainLayout.Children.Add(new TextBlock()
{
Text = Description,
TextWrapping = TextWrapping.Wrap,
Margin = new Thickness(0, 10, 0, 0)
});
mainLayout.Children.Add(new Border
{
Height = 10,
Background = Brushes.Transparent
});
mainLayout.Children.Add(showCaseTitle);
mainLayout.Children.Add(new TextBlock
{
Text = Description,
TextWrapping = TextWrapping.Wrap,
Margin = new Thickness(0, 10, 0, 0)
});
var outerBorder = new Border()
{
BorderBrush = new SolidColorBrush(new Color(10, 5, 5, 5)),
BorderThickness = new Thickness(1),
Padding = new Thickness(20),
Child = mainLayout,
CornerRadius = new CornerRadius(8)
};
var outerBorder = new Border
{
BorderBrush = new SolidColorBrush(new Color(10, 5, 5, 5)),
BorderThickness = new Thickness(1),
Padding = new Thickness(20),
Child = mainLayout,
CornerRadius = new CornerRadius(8)
};
Content = outerBorder;
}
Content = outerBorder;
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
if (!_initialized) {
SetupUi();
_initialized = true;
}
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
if (!_initialized)
{
SetupUi();
_initialized = true;
}
}
}

View File

@ -10,83 +10,82 @@ namespace AtomUI.Demo.Desktop;
public class ShowCasePanel : Control
{
public string? Id { get; protected set; }
private bool _initialized = false;
private StackPanel _leftContainer = default!;
private StackPanel _rightContainer = default!;
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()
{
Rows = 1,
Columns = 2,
Margin = new Thickness(0)
};
_leftContainer = new StackPanel()
{
Orientation = Orientation.Vertical,
Spacing = 10,
Margin = new Thickness(0, 0, 10, 0),
};
_rightContainer = new StackPanel()
{
Orientation = Orientation.Vertical,
Spacing = 10,
};
mainLayout.Children.Add(_leftContainer);
mainLayout.Children.Add(_rightContainer);
protected void SetupUi()
{
var mainLayout = new UniformGrid
{
Rows = 1,
Columns = 2,
Margin = new Thickness(0)
};
_leftContainer = new StackPanel
{
Orientation = Orientation.Vertical,
Spacing = 10,
Margin = new Thickness(0, 0, 10, 0)
};
_rightContainer = new StackPanel
{
Orientation = Orientation.Vertical,
Spacing = 10
};
mainLayout.Children.Add(_leftContainer);
mainLayout.Children.Add(_rightContainer);
for (int i = 0; i < Children.Count; ++i) {
var control = Children[i];
if (i % 2 == 0) {
_leftContainer.Children.Add(control);
} else {
_rightContainer.Children.Add(control);
}
}
var scrollView = new ScrollViewer()
{
Content = mainLayout,
};
LogicalChildren.Add(scrollView);
VisualChildren.Add(scrollView);
}
for (var i = 0; i < Children.Count; ++i)
{
var control = Children[i];
if (i % 2 == 0)
_leftContainer.Children.Add(control);
else
_rightContainer.Children.Add(control);
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
if (!_initialized) {
SetupUi();
NotifyShowCaseLayoutReady();
_initialized = true;
}
base.OnAttachedToLogicalTree(e);
}
var scrollView = new ScrollViewer
{
Content = mainLayout
};
LogicalChildren.Add(scrollView);
VisualChildren.Add(scrollView);
}
internal virtual void NotifyAboutToActive()
{
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
if (!_initialized)
{
SetupUi();
NotifyShowCaseLayoutReady();
_initialized = true;
}
internal virtual void NotifyActivated()
{
}
base.OnAttachedToLogicalTree(e);
}
internal virtual void NotifyAboutToDeactivated()
{
}
internal virtual void NotifyAboutToActive()
{
}
internal virtual void NotifyDeactivated()
{
}
internal virtual void NotifyActivated()
{
}
protected virtual void NotifyShowCaseLayoutReady()
{
}
internal virtual void NotifyAboutToDeactivated()
{
}
internal virtual void NotifyDeactivated()
{
}
protected virtual void NotifyShowCaseLayoutReady()
{
}
}

View File

@ -1,15 +1,19 @@
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?>(
nameof(ColorName));
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
{
@ -17,9 +21,6 @@ public class ColorItemControl : TemplatedControl
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);
}
}

View File

@ -6,12 +6,13 @@ namespace AtomUI.Demo.Desktop.Controls;
public class ColorListControl : TemplatedControl
{
public static readonly StyledProperty<ColorListViewModel> ListDataProperty = AvaloniaProperty.Register<ColorListGroupControl, ColorListViewModel>(
nameof(ListData), new ColorListViewModel());
public static readonly StyledProperty<ColorListViewModel> ListDataProperty =
AvaloniaProperty.Register<ColorListGroupControl, ColorListViewModel>(
nameof(ListData), new ColorListViewModel());
public ColorListViewModel ListData
{
get => GetValue(ListDataProperty);
set => SetValue(ListDataProperty, value);
}
public ColorListViewModel ListData
{
get => GetValue(ListDataProperty);
set => SetValue(ListDataProperty, value);
}
}

View File

@ -6,12 +6,13 @@ namespace AtomUI.Demo.Desktop.Controls;
public class ColorListGroupControl : TemplatedControl
{
public static readonly StyledProperty<ColorGroupViewModel> GroupDataProperty = AvaloniaProperty.Register<ColorListGroupControl, ColorGroupViewModel>(
nameof(GroupData), new ColorGroupViewModel());
public static readonly StyledProperty<ColorGroupViewModel> GroupDataProperty =
AvaloniaProperty.Register<ColorListGroupControl, ColorGroupViewModel>(
nameof(GroupData), new ColorGroupViewModel());
public ColorGroupViewModel GroupData
{
get => GetValue(GroupDataProperty);
set => SetValue(GroupDataProperty, value);
}
public ColorGroupViewModel GroupData
{
get => GetValue(GroupDataProperty);
set => SetValue(GroupDataProperty, value);
}
}

View File

@ -1,50 +1,47 @@
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?>(
nameof(IconThemeType));
public static readonly StyledProperty<IconThemeType?> IconThemeTypeProperty = AvaloniaProperty.Register<IconInfoItem, IconThemeType?>(
nameof(IconThemeType));
private readonly IconGalleryModel _galleryModel;
private bool _initialized;
public IconThemeType? IconThemeType
{
get => GetValue(IconThemeTypeProperty);
set => SetValue(IconThemeTypeProperty, value);
}
public IconGallery()
{
_galleryModel = new IconGalleryModel();
DataContext = _galleryModel;
}
public IconGallery()
{
_galleryModel = new IconGalleryModel();
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);
}
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
base.OnAttachedToLogicalTree(e);
if (!_initialized) {
if (IconThemeType.HasValue) {
_galleryModel.LoadThemeIcons(IconThemeType.Value);
}
_initialized = true;
}
}
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
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);
_initialized = true;
}
}
}

View File

@ -5,21 +5,21 @@ namespace AtomUI.Demo.Desktop.Controls;
public class IconInfoItem : TemplatedControl
{
public static readonly StyledProperty<string> IconNameProperty = AvaloniaProperty.Register<IconInfoItem, string>(
nameof(IconName));
public static readonly StyledProperty<string> IconNameProperty = AvaloniaProperty.Register<IconInfoItem, string>(
nameof(IconName));
public string IconName
{
get => GetValue(IconNameProperty);
set => SetValue(IconNameProperty, value);
}
public static readonly StyledProperty<string> IconKindProperty = AvaloniaProperty.Register<IconInfoItem, string>(
nameof(IconKind));
public static readonly StyledProperty<string> IconKindProperty = AvaloniaProperty.Register<IconInfoItem, string>(
nameof(IconKind));
public string IconName
{
get => GetValue(IconNameProperty);
set => SetValue(IconNameProperty, value);
}
public string IconKind
{
get => GetValue(IconKindProperty);
set => SetValue(IconKindProperty, value);
}
public string IconKind
{
get => GetValue(IconKindProperty);
set => SetValue(IconKindProperty, value);
}
}

View File

@ -4,41 +4,43 @@ 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()
.With(new FontManagerOptions
{
FontFallbacks = new[]
{
new FontFallback
{
FontFamily = new FontFamily("Microsoft YaHei")
}
}
})
.StartWithClassicDesktopLifetime(args);
// 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()
.With(new FontManagerOptions
{
FontFallbacks = new[]
{
new FontFallback
{
FontFamily = new FontFamily("Microsoft YaHei")
}
}
})
.StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UseManagedSystemDialogs()
.UsePlatformDetect()
.UseAtomUI()
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UseManagedSystemDialogs()
.UsePlatformDetect()
.UseAtomUI()
#if DEBUG
.UseDevToolsForAvalonia()
.UseDevToolsForAvalonia()
#endif
.UseIconPackage<AntDesignIconPackage>(true)
.With(new Win32PlatformOptions())
.LogToTrace();
.UseIconPackage<AntDesignIconPackage>(true)
.With(new Win32PlatformOptions())
.LogToTrace();
}

View File

@ -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,9 +29,10 @@
<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"
IsClosable="True"
Type="Error">
<atom:Alert
Description="Error Description Error Description Error Description Error Description Error Description Error Description"
IsClosable="True"
Type="Error">
Error Text
</atom:Alert>
<atom:Alert CloseIcon="{atom:IconProvider CloseSquareFilled}"
@ -51,9 +52,10 @@
<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"
Message="Warning Text"
Type="Warning" />
<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"
Message="Error Text"
Type="Error" />

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class AlertShowCase : UserControl
{
public AlertShowCase()
{
InitializeComponent();
}
public AlertShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class AvatarShowCase : UserControl
{
public AvatarShowCase()
{
InitializeComponent();
}
public AvatarShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -5,99 +5,103 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class BadgeShowCase : UserControl
{
public static readonly StyledProperty<double> DynamicBadgeCountProperty =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(DynamicBadgeCount), 5);
public static readonly StyledProperty<double> DynamicBadgeCountProperty =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(DynamicBadgeCount), 5);
public static readonly StyledProperty<bool> DynamicDotBadgeVisibleProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(DynamicDotBadgeVisible), true);
public static readonly StyledProperty<bool> DynamicDotBadgeVisibleProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(DynamicDotBadgeVisible), true);
public static readonly StyledProperty<bool> StandaloneSwitchCheckedProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(StandaloneSwitchChecked), true);
public static readonly StyledProperty<bool> StandaloneSwitchCheckedProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(StandaloneSwitchChecked), true);
public static readonly StyledProperty<double> StandaloneBadgeCount1Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount1), 11);
public static readonly StyledProperty<double> StandaloneBadgeCount1Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount1), 11);
public static readonly StyledProperty<double> StandaloneBadgeCount2Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount2), 25);
public static readonly StyledProperty<double> StandaloneBadgeCount2Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount2), 25);
public static readonly StyledProperty<double> StandaloneBadgeCount3Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount3), 109);
public static readonly StyledProperty<double> StandaloneBadgeCount3Property =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(StandaloneBadgeCount3), 109);
public double DynamicBadgeCount
{
get => GetValue(DynamicBadgeCountProperty);
set => SetValue(DynamicBadgeCountProperty, value);
}
public BadgeShowCase()
{
DataContext = this;
InitializeComponent();
}
public bool DynamicDotBadgeVisible
{
get => GetValue(DynamicDotBadgeVisibleProperty);
set => SetValue(DynamicDotBadgeVisibleProperty, value);
}
public double DynamicBadgeCount
{
get => GetValue(DynamicBadgeCountProperty);
set => SetValue(DynamicBadgeCountProperty, value);
}
public bool StandaloneSwitchChecked
{
get => GetValue(StandaloneSwitchCheckedProperty);
set => SetValue(StandaloneSwitchCheckedProperty, value);
}
public bool DynamicDotBadgeVisible
{
get => GetValue(DynamicDotBadgeVisibleProperty);
set => SetValue(DynamicDotBadgeVisibleProperty, value);
}
public double StandaloneBadgeCount1
{
get => GetValue(StandaloneBadgeCount1Property);
set => SetValue(StandaloneBadgeCount1Property, value);
}
public bool StandaloneSwitchChecked
{
get => GetValue(StandaloneSwitchCheckedProperty);
set => SetValue(StandaloneSwitchCheckedProperty, value);
}
public double StandaloneBadgeCount2
{
get => GetValue(StandaloneBadgeCount2Property);
set => SetValue(StandaloneBadgeCount2Property, value);
}
public double StandaloneBadgeCount1
{
get => GetValue(StandaloneBadgeCount1Property);
set => SetValue(StandaloneBadgeCount1Property, value);
}
public double StandaloneBadgeCount3
{
get => GetValue(StandaloneBadgeCount3Property);
set => SetValue(StandaloneBadgeCount3Property, value);
}
public double StandaloneBadgeCount2
{
get => GetValue(StandaloneBadgeCount2Property);
set => SetValue(StandaloneBadgeCount2Property, value);
}
public BadgeShowCase()
{
DataContext = this;
InitializeComponent();
}
public double StandaloneBadgeCount3
{
get => GetValue(StandaloneBadgeCount3Property);
set => SetValue(StandaloneBadgeCount3Property, value);
}
public void AddDynamicBadgeCount()
{
DynamicBadgeCount += 1;
}
public void AddDynamicBadgeCount()
{
DynamicBadgeCount += 1;
}
public void SubDynamicBadgeCount()
{
var value = DynamicBadgeCount;
value -= 1;
value = Math.Max(value, 0);
DynamicBadgeCount = value;
}
public void SubDynamicBadgeCount()
{
var value = DynamicBadgeCount;
value -= 1;
value = Math.Max(value, 0);
DynamicBadgeCount = value;
}
public void RandomDynamicBadgeCount()
{
var random = new Random();
DynamicBadgeCount = random.Next(0, 110);
}
public void RandomDynamicBadgeCount()
{
var random = new Random();
DynamicBadgeCount = random.Next(0, 110);
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs args)
{
base.OnPropertyChanged(args);
if (args.Property == StandaloneSwitchCheckedProperty) {
var isChecked = args.GetNewValue<bool>();
if (isChecked) {
StandaloneBadgeCount1 = 11;
StandaloneBadgeCount2 = 25;
StandaloneBadgeCount3 = 109;
} else {
StandaloneBadgeCount1 = 0;
StandaloneBadgeCount2 = 0;
StandaloneBadgeCount3 = 0;
}
}
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs args)
{
base.OnPropertyChanged(args);
if (args.Property == StandaloneSwitchCheckedProperty)
{
var isChecked = args.GetNewValue<bool>();
if (isChecked)
{
StandaloneBadgeCount1 = 11;
StandaloneBadgeCount2 = 25;
StandaloneBadgeCount3 = 109;
}
else
{
StandaloneBadgeCount1 = 0;
StandaloneBadgeCount2 = 0;
StandaloneBadgeCount3 = 0;
}
}
}
}

View File

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

View File

@ -9,46 +9,46 @@ 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 static readonly StyledProperty<SizeType> ButtonSizeTypeProperty =
AvaloniaProperty.Register<ButtonShowCase, SizeType>(nameof(ButtonSizeType));
public SizeType ButtonSizeType
{
get => GetValue(ButtonSizeTypeProperty);
set => SetValue(ButtonSizeTypeProperty, value);
}
public ButtonShowCase()
{
InitializeComponent();
DataContext = this;
public ButtonShowCase()
{
InitializeComponent();
DataContext = this;
ButtonSizeTypeOptionGroup.OptionCheckedChanged += HandleButtonSizeTypeOptionCheckedChanged;
LoadingBtn1.Click += HandleLoadingBtnClick;
LoadingBtn2.Click += HandleLoadingBtnClick;
LoadingBtn3.Click += HandleLoadingBtnClick;
}
ButtonSizeTypeOptionGroup.OptionCheckedChanged += HandleButtonSizeTypeOptionCheckedChanged;
LoadingBtn1.Click += HandleLoadingBtnClick;
LoadingBtn2.Click += HandleLoadingBtnClick;
LoadingBtn3.Click += HandleLoadingBtnClick;
}
public SizeType ButtonSizeType
{
get => GetValue(ButtonSizeTypeProperty);
set => SetValue(ButtonSizeTypeProperty, value);
}
private void HandleButtonSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
ButtonSizeType = SizeType.Large;
} else if (args.Index == 1) {
ButtonSizeType = SizeType.Middle;
} else {
ButtonSizeType = SizeType.Small;
}
}
private void HandleButtonSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
ButtonSizeType = SizeType.Large;
else if (args.Index == 1)
ButtonSizeType = SizeType.Middle;
else
ButtonSizeType = SizeType.Small;
}
private void HandleLoadingBtnClick(object? sender, RoutedEventArgs args)
{
if (sender is Button button) {
button.IsLoading = true;
Dispatcher.UIThread.InvokeAsync(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(3));
button.IsLoading = false;
});
}
}
private void HandleLoadingBtnClick(object? sender, RoutedEventArgs args)
{
if (sender is Button button)
{
button.IsLoading = true;
Dispatcher.UIThread.InvokeAsync(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(3));
button.IsLoading = false;
});
}
}
}

View File

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

View File

@ -4,39 +4,35 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class ButtonSpinnerShowCase : UserControl
{
public ButtonSpinnerShowCase()
{
InitializeComponent();
}
private readonly string[] _spinnerItems =
{
"床前明月光",
"疑是地上霜",
"举头望明月",
"低头思故乡"
};
public void HandleSpin(object sender, SpinEventArgs e)
{
var spinner = (ButtonSpinner)sender;
public ButtonSpinnerShowCase()
{
InitializeComponent();
}
if (spinner.Content is TextBlock textBlock)
{
int value = Array.IndexOf(_spinnerItems, textBlock.Text);
if (e.Direction == SpinDirection.Increase) {
value++;
} else {
value--;
}
public void HandleSpin(object sender, SpinEventArgs e)
{
var spinner = (ButtonSpinner)sender;
if (value < 0) {
value = _spinnerItems.Length - 1;
} else if (value >= _spinnerItems.Length) {
value = 0;
}
textBlock.Text = _spinnerItems[value];
}
if (spinner.Content is TextBlock textBlock)
{
var value = Array.IndexOf(_spinnerItems, textBlock.Text);
if (e.Direction == SpinDirection.Increase)
value++;
else
value--;
}
private readonly string[] _spinnerItems = new[]
{
"床前明月光",
"疑是地上霜",
"举头望明月",
"低头思故乡"
};
if (value < 0)
value = _spinnerItems.Length - 1;
else if (value >= _spinnerItems.Length) value = 0;
textBlock.Text = _spinnerItems[value];
}
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class CardShowCase : UserControl
{
public CardShowCase()
{
InitializeComponent();
}
public CardShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -5,9 +5,9 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class CheckBoxShowCase : UserControl
{
public CheckBoxShowCase()
{
DataContext = new CheckBoxShowCaseModel();
InitializeComponent();
}
public CheckBoxShowCase()
{
DataContext = new CheckBoxShowCaseModel();
InitializeComponent();
}
}

View File

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

View File

@ -6,28 +6,27 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class CollapseShowCase : UserControl
{
public static readonly StyledProperty<CollapseExpandIconPosition> CollapseExpandIconPositionProperty =
AvaloniaProperty.Register<CollapseShowCase, CollapseExpandIconPosition>(nameof(CollapseExpandIconPosition), CollapseExpandIconPosition.Start);
public static readonly StyledProperty<CollapseExpandIconPosition> CollapseExpandIconPositionProperty =
AvaloniaProperty.Register<CollapseShowCase, CollapseExpandIconPosition>(nameof(CollapseExpandIconPosition));
public CollapseExpandIconPosition CollapseExpandIconPosition
{
get => GetValue(CollapseExpandIconPositionProperty);
set => SetValue(CollapseExpandIconPositionProperty, value);
}
public CollapseShowCase()
{
InitializeComponent();
DataContext = this;
public CollapseShowCase()
{
InitializeComponent();
DataContext = this;
//ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
}
//ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
}
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
CollapseExpandIconPosition = CollapseExpandIconPosition.Start;
} else if (args.Index == 1) {
CollapseExpandIconPosition = CollapseExpandIconPosition.End;
}
}
public CollapseExpandIconPosition CollapseExpandIconPosition
{
get => GetValue(CollapseExpandIconPositionProperty);
set => SetValue(CollapseExpandIconPositionProperty, value);
}
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
CollapseExpandIconPosition = CollapseExpandIconPosition.Start;
else if (args.Index == 1) CollapseExpandIconPosition = CollapseExpandIconPosition.End;
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class ComboBoxShowCase : UserControl
{
public ComboBoxShowCase()
{
InitializeComponent();
}
public ComboBoxShowCase()
{
InitializeComponent();
}
}

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class DatePickerShowCase : UserControl
{
public DatePickerShowCase()
{
InitializeComponent();
}
public DatePickerShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -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,15 +66,17 @@
<atom:ToggleSwitch Content="Open" />
</StackPanel>
<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}">
<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..." />
</atom:Drawer>
</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,9 +85,10 @@
<atom:ToggleSwitch Content="Open" />
</StackPanel>
<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}">
<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 " />
</atom:Drawer>
</Panel>
@ -102,9 +105,10 @@
<atom:ToggleSwitch Content="Open" />
</StackPanel>
<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}">
<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... " />
</atom:Drawer>
</Panel>

View File

@ -8,28 +8,22 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class DrawerShowCase : UserControl
{
public DrawerShowCase()
{
InitializeComponent();
}
public DrawerShowCase()
{
InitializeComponent();
}
private void Button_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is not Button button)
{
return;
}
private void Button_OnClick(object? sender, RoutedEventArgs e)
{
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;
}
drawer.IsOpen = false;
}
private void ButtonOpenOnCurrentParent_OnClick(object? sender, RoutedEventArgs e)
{
Drawer1.OpenOn = Drawer1.OpenOn?.Parent as Visual;
}
private void ButtonOpenOnCurrentParent_OnClick(object? sender, RoutedEventArgs e)
{
Drawer1.OpenOn = Drawer1.OpenOn?.Parent as Visual;
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class DropdownButtonShowCase : UserControl
{
public DropdownButtonShowCase()
{
InitializeComponent();
}
public DropdownButtonShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class EmptyShowCase : UserControl
{
public EmptyShowCase()
{
InitializeComponent();
}
public EmptyShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -6,51 +6,47 @@ 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 static readonly StyledProperty<ExpanderIconPosition> ToggleIconPositionProperty =
AvaloniaProperty.Register<ExpanderShowCase, ExpanderIconPosition>(nameof(ToggleIconPosition));
public ExpanderIconPosition ToggleIconPosition
{
get => GetValue(ToggleIconPositionProperty);
set => SetValue(ToggleIconPositionProperty, value);
}
public static readonly StyledProperty<ExpandDirection> ExpandDirectionProperty =
AvaloniaProperty.Register<ExpanderShowCase, ExpandDirection>(nameof(ExpandDirection));
public static readonly StyledProperty<ExpandDirection> ExpandDirectionProperty =
AvaloniaProperty.Register<ExpanderShowCase, ExpandDirection>(nameof(ExpandDirection), ExpandDirection.Down);
public ExpanderShowCase()
{
InitializeComponent();
DataContext = this;
ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
ExpandDirectionOptionGroup.OptionCheckedChanged += HandleExpandDirectionOptionCheckedChanged;
}
public ExpandDirection ExpandDirection
{
get => GetValue(ExpandDirectionProperty);
set => SetValue(ExpandDirectionProperty, value);
}
public ExpanderIconPosition ToggleIconPosition
{
get => GetValue(ToggleIconPositionProperty);
set => SetValue(ToggleIconPositionProperty, value);
}
public ExpanderShowCase()
{
InitializeComponent();
DataContext = this;
ExpandButtonPosGroup.OptionCheckedChanged += HandleExpandButtonPosOptionCheckedChanged;
ExpandDirectionOptionGroup.OptionCheckedChanged += HandleExpandDirectionOptionCheckedChanged;
}
public ExpandDirection ExpandDirection
{
get => GetValue(ExpandDirectionProperty);
set => SetValue(ExpandDirectionProperty, value);
}
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
ToggleIconPosition = ExpanderIconPosition.Start;
} else if (args.Index == 1) {
ToggleIconPosition = ExpanderIconPosition.End;
}
}
private void HandleExpandButtonPosOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
ToggleIconPosition = ExpanderIconPosition.Start;
else if (args.Index == 1) ToggleIconPosition = ExpanderIconPosition.End;
}
private void HandleExpandDirectionOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
ExpandDirection = ExpandDirection.Down;
} else if (args.Index == 1) {
ExpandDirection = ExpandDirection.Up;
} else if (args.Index == 2) {
ExpandDirection = ExpandDirection.Left;
} else if (args.Index == 3) {
ExpandDirection = ExpandDirection.Right;
}
}
private void HandleExpandDirectionOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
ExpandDirection = ExpandDirection.Down;
else if (args.Index == 1)
ExpandDirection = ExpandDirection.Up;
else if (args.Index == 2)
ExpandDirection = ExpandDirection.Left;
else if (args.Index == 3) ExpandDirection = ExpandDirection.Right;
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class GroupBoxShowCase : UserControl
{
public GroupBoxShowCase()
{
InitializeComponent();
}
public GroupBoxShowCase()
{
InitializeComponent();
}
}

View File

@ -1,25 +1,22 @@
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;
public partial class IconShowCase : UserControl
{
public IconShowCase()
{
InitializeComponent();
}
public IconShowCase()
{
InitializeComponent();
}
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
PaletteDemoViewModel vm = new PaletteDemoViewModel();
await Dispatcher.UIThread.InvokeAsync(() =>
{
vm.InitializeResources();
});
DataContext = vm;
}
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
var vm = new PaletteDemoViewModel();
await Dispatcher.UIThread.InvokeAsync(() => { vm.InitializeResources(); });
DataContext = vm;
}
}

View File

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

View File

@ -6,44 +6,49 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class InfoFlyoutShowCase : UserControl
{
public static readonly StyledProperty<bool> ShowArrowProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
public static readonly StyledProperty<bool> ShowArrowProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter), false);
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter));
private Segmented _segmented;
private readonly Segmented _segmented;
public bool ShowArrow
{
get => GetValue(ShowArrowProperty);
set => SetValue(ShowArrowProperty, 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;
}
};
}
public bool IsPointAtCenter
{
get => GetValue(IsPointAtCenterProperty);
set => SetValue(IsPointAtCenterProperty, value);
}
public bool ShowArrow
{
get => GetValue(ShowArrowProperty);
set => SetValue(ShowArrowProperty, 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;
}
};
}
public bool IsPointAtCenter
{
get => GetValue(IsPointAtCenterProperty);
set => SetValue(IsPointAtCenterProperty, value);
}
}

View File

@ -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,11 +83,12 @@
<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,
InnerRightContent="{atom:IconProvider Kind=InfoCircleOutlined,
NormalFilledColor=#8C8C8C}"
Watermark="Enter your username" />
Watermark="Enter your username" />
<atom:LineEdit InnerLeftContent="¥" InnerRightContent="RMB" />
<atom:LineEdit InnerLeftContent="¥"
InnerRightContent="RMB"
@ -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">

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class LineEditShowCase : UserControl
{
public LineEditShowCase()
{
InitializeComponent();
}
public LineEditShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class ListBoxShowCase : UserControl
{
public ListBoxShowCase()
{
InitializeComponent();
}
public ListBoxShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -5,19 +5,18 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class LoadingIndicatorShowCase : UserControl
{
public static readonly StyledProperty<bool> IsLoadingSwitchCheckedProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(IsLoadingSwitchChecked), false);
public static readonly StyledProperty<bool> IsLoadingSwitchCheckedProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(IsLoadingSwitchChecked));
public bool IsLoadingSwitchChecked
{
get => GetValue(IsLoadingSwitchCheckedProperty);
set => SetValue(IsLoadingSwitchCheckedProperty, value);
}
public LoadingIndicatorShowCase()
{
DataContext = this;
InitializeComponent();
}
public LoadingIndicatorShowCase()
{
DataContext = this;
InitializeComponent();
}
public bool IsLoadingSwitchChecked
{
get => GetValue(IsLoadingSwitchCheckedProperty);
set => SetValue(IsLoadingSwitchCheckedProperty, value);
}
}

View File

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

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class MenuShowCase : UserControl
{
public MenuShowCase()
{
InitializeComponent();
}
public MenuShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -7,92 +7,92 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class MessageShowCase : UserControl
{
private WindowMessageManager? _messageManager;
private WindowMessageManager? _messageManager;
public MessageShowCase()
{
InitializeComponent();
}
public MessageShowCase()
{
InitializeComponent();
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
var topLevel = TopLevel.GetTopLevel(this);
_messageManager = new WindowMessageManager(topLevel)
{
MaxItems = 10
};
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
var topLevel = TopLevel.GetTopLevel(this);
_messageManager = new WindowMessageManager(topLevel)
{
MaxItems = 10
};
}
private void ShowSimpleMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
content: "Hello, AtomUI/Avalonia!"
));
}
private void ShowSimpleMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
"Hello, AtomUI/Avalonia!"
));
}
private void ShowInfoMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Information,
content: "This is a information message."
));
}
private void ShowInfoMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Information,
content: "This is a information message."
));
}
private void ShowSuccessMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Success,
content: "This is a success message."
));
}
private void ShowSuccessMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Success,
content: "This is a success message."
));
}
private void ShowWarningMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Warning,
content: "This is a warning message."
));
}
private void ShowWarningMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Warning,
content: "This is a warning message."
));
}
private void ShowErrorMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Error,
content: "This is a error message."
));
}
private void ShowErrorMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Error,
content: "This is a error message."
));
}
private void ShowLoadingMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Loading,
content: "Action in progress..."
));
}
private void ShowLoadingMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Loading,
content: "Action in progress..."
));
}
private void ShowSequentialMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Loading,
content: "Action in progress...",
expiration: TimeSpan.FromSeconds(2.5),
onClose: () =>
{
_messageManager?.Show(new Message(
type: MessageType.Success,
expiration: TimeSpan.FromSeconds(2.5),
content: "Loading finished",
onClose: () =>
{
_messageManager?.Show(new Message(
type: MessageType.Information,
expiration: TimeSpan.FromSeconds(2.5),
content: "Loading finished"
));
}
));
}
));
}
private void ShowSequentialMessage(object? sender, RoutedEventArgs e)
{
_messageManager?.Show(new Message(
type: MessageType.Loading,
content: "Action in progress...",
expiration: TimeSpan.FromSeconds(2.5),
onClose: () =>
{
_messageManager?.Show(new Message(
type: MessageType.Success,
expiration: TimeSpan.FromSeconds(2.5),
content: "Loading finished",
onClose: () =>
{
_messageManager?.Show(new Message(
type: MessageType.Information,
expiration: TimeSpan.FromSeconds(2.5),
content: "Loading finished"
));
}
));
}
));
}
}

View File

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

View File

@ -8,199 +8,204 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class NotificationShowCase : UserControl
{
private WindowNotificationManager? _basicManager;
private WindowNotificationManager? _topLeftManager;
private WindowNotificationManager? _topManager;
private WindowNotificationManager? _topRightManager;
private WindowNotificationManager? _basicManager;
private WindowNotificationManager? _bottomLeftManager;
private WindowNotificationManager? _bottomManager;
private WindowNotificationManager? _bottomRightManager;
private WindowNotificationManager? _bottomLeftManager;
private WindowNotificationManager? _bottomManager;
private WindowNotificationManager? _bottomRightManager;
private WindowNotificationManager? _topLeftManager;
private WindowNotificationManager? _topManager;
private WindowNotificationManager? _topRightManager;
public NotificationShowCase()
{
InitializeComponent();
HoverOptionGroup.OptionCheckedChanged += HandleHoverOptionGroupCheckedChanged;
}
public NotificationShowCase()
{
InitializeComponent();
HoverOptionGroup.OptionCheckedChanged += HandleHoverOptionGroupCheckedChanged;
}
private void HandleHoverOptionGroupCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (_basicManager is not null) {
if (args.Index == 0) {
_basicManager.IsPauseOnHover = true;
} else {
_basicManager.IsPauseOnHover = false;
}
}
}
private void HandleHoverOptionGroupCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (_basicManager is not null)
{
if (args.Index == 0)
_basicManager.IsPauseOnHover = true;
else
_basicManager.IsPauseOnHover = false;
}
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
var topLevel = TopLevel.GetTopLevel(this);
_basicManager = new WindowNotificationManager(topLevel)
{
MaxItems = 3
};
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
var topLevel = TopLevel.GetTopLevel(this);
_basicManager = new WindowNotificationManager(topLevel)
{
MaxItems = 3
};
_topLeftManager = new WindowNotificationManager(topLevel)
{
MaxItems = 3,
Position = NotificationPosition.TopLeft
};
_topLeftManager = new WindowNotificationManager(topLevel)
{
MaxItems = 3,
Position = NotificationPosition.TopLeft
};
_topManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.TopCenter,
MaxItems = 3
};
_topManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.TopCenter,
MaxItems = 3
};
_topRightManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.TopRight,
MaxItems = 3
};
_topRightManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.TopRight,
MaxItems = 3
};
_bottomLeftManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomLeft,
MaxItems = 3
};
_bottomLeftManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomLeft,
MaxItems = 3
};
_bottomManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomCenter,
MaxItems = 3
};
_bottomManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomCenter,
MaxItems = 3
};
_bottomRightManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomRight,
MaxItems = 3
};
}
_bottomRightManager = new WindowNotificationManager(topLevel)
{
Position = NotificationPosition.BottomRight,
MaxItems = 3
};
}
private void ShowSimpleNotification(object? sender, RoutedEventArgs e)
{
_basicManager?.Show(new Notification(
title: "Notification Title",
content: "Hello, AtomUI/Avalonia!"
));
}
private void ShowSimpleNotification(object? sender, RoutedEventArgs e)
{
_basicManager?.Show(new Notification(
"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."
));
}
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."
));
}
private void ShowSuccessNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowSuccessNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowInfoNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowInfoNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowWarningNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowWarningNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowErrorNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowErrorNotification(object? sender, RoutedEventArgs e)
{
_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."
));
}
private void ShowTopNotification(object? sender, RoutedEventArgs e)
{
_topManager?.Show(new Notification(
title : "Notification Top",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowTopNotification(object? sender, RoutedEventArgs e)
{
_topManager?.Show(new Notification(
"Notification Top",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomNotification(object? sender, RoutedEventArgs e)
{
_bottomManager?.Show(new Notification(
title : "Notification Bottom",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomNotification(object? sender, RoutedEventArgs e)
{
_bottomManager?.Show(new Notification(
"Notification Bottom",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowTopLeftNotification(object? sender, RoutedEventArgs e)
{
_topLeftManager?.Show(new Notification(
title : "Notification TopLeft",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowTopLeftNotification(object? sender, RoutedEventArgs e)
{
_topLeftManager?.Show(new Notification(
"Notification TopLeft",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowTopRightNotification(object? sender, RoutedEventArgs e)
{
_topRightManager?.Show(new Notification(
title : "Notification TopRight",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowTopRightNotification(object? sender, RoutedEventArgs e)
{
_topRightManager?.Show(new Notification(
"Notification TopRight",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomLeftNotification(object? sender, RoutedEventArgs e)
{
_bottomLeftManager?.Show(new Notification(
title : "Notification BottomLeft",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomLeftNotification(object? sender, RoutedEventArgs e)
{
_bottomLeftManager?.Show(new Notification(
"Notification BottomLeft",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomRightNotification(object? sender, RoutedEventArgs e)
{
_bottomRightManager?.Show(new Notification(
title : "Notification BottomRight",
content : "Hello, AtomUI/Avalonia!"
));
}
private void ShowBottomRightNotification(object? sender, RoutedEventArgs e)
{
_bottomRightManager?.Show(new Notification(
"Notification BottomRight",
"Hello, AtomUI/Avalonia!"
));
}
private void ShowCustomIconNotification(object? sender, RoutedEventArgs e)
{
_basicManager?.Show(new Notification(
"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"
}
));
}
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()
{
Kind = "SettingOutlined"
}
));
}
private void ShowProgressNotification(object? sender, RoutedEventArgs e)
{
_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
));
}
private void ShowProgressNotification(object? sender, RoutedEventArgs e)
{
_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
));
}
}

View File

@ -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,11 +59,12 @@
<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,
InnerRightContent="{atom:IconProvider Kind=InfoCircleOutlined,
NormalFilledColor=#8C8C8C}"
Watermark="Enter your value" />
Watermark="Enter your value" />
<atom:NumericUpDown InnerLeftContent="¥" InnerRightContent="RMB" />
<atom:NumericUpDown InnerLeftContent="¥"
InnerRightContent="RMB"
@ -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">

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class NumberUpDownShowCase : UserControl
{
public NumberUpDownShowCase()
{
InitializeComponent();
}
public NumberUpDownShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -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>
<StyleInclude Source="avares://AtomUI/Themes/Index.axaml" />
</Application.Styles>
""";
<Application.Styles>
<StyleInclude Source="avares://AtomUI/Themes/Index.axaml" />
</Application.Styles>
""";
public string ColorPickerInstall { get; set; } = "dotnet add package AtomUI.ColorPicker --version 11.0.7";
public string ColorPickerStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://AtomUI.ColorPicker/Index.axaml" />
</Application.Styles>
""";
<Application.Styles>
<StyleInclude Source="avares://AtomUI.ColorPicker/Index.axaml" />
</Application.Styles>
""";
public string DataGridInstall { get; set; } = "dotnet add package AtomUI.DataGrid --version 11.0.7";
public string DataGridStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://AtomUI.DataGrid/Index.axaml" />
</Application.Styles>
""";
<Application.Styles>
<StyleInclude Source="avares://AtomUI.DataGrid/Index.axaml" />
</Application.Styles>
""";
public string TreeDataGridInstall { get; set; } = "dotnet add package AtomUI.TreeDataGrid --version 11.0.7";
public string TreeDataGridStyle { get; set; } = """
<Application.Styles>
<StyleInclude Source="avares://AtomUI.TreeDataGrid/Index.axaml" />
</Application.Styles>
""";
<Application.Styles>
<StyleInclude Source="avares://AtomUI.TreeDataGrid/Index.axaml" />
</Application.Styles>
""";
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class PaginationShowCase : UserControl
{
public PaginationShowCase()
{
InitializeComponent();
}
public PaginationShowCase()
{
InitializeComponent();
}
}

View File

@ -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;
@ -12,14 +12,11 @@ public partial class PaletteShowCase : UserControl
InitializeComponent();
}
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
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;
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class PopupConfirmShowCase : UserControl
{
public PopupConfirmShowCase()
{
InitializeComponent();
}
public PopupConfirmShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -7,130 +7,129 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class ProgressBarShowCase : UserControl
{
public LinearGradientBrush TwoStopsGradientStrokeColor { get; set; }
public static readonly StyledProperty<double> ProgressValueProperty =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(ProgressValue), 30);
public LinearGradientBrush ThreeStopsGradientStrokeColor { get; set; }
public static readonly StyledProperty<string> ToggleDisabledTextProperty =
AvaloniaProperty.Register<ProgressBarShowCase, string>(nameof(ToggleDisabledText), "Disable");
public List<IBrush> StepsChunkBrushes { get; set; }
public static readonly StyledProperty<bool> ToggleStatusProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(ToggleStatus), true);
public PercentPosition InnerStartPercentPosition { get; set; }
public PercentPosition InnerCenterPercentPosition { get; set; }
public PercentPosition InnerEndPercentPosition { get; set; }
public ProgressBarShowCase()
{
InitializeComponent();
DataContext = this;
public PercentPosition OutterStartPercentPosition { get; set; }
public PercentPosition OutterCenterPercentPosition { get; set; }
public PercentPosition OutterEndPercentPosition { get; set; }
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)
};
public static readonly StyledProperty<double> ProgressValueProperty =
AvaloniaProperty.Register<ProgressBarShowCase, double>(nameof(ProgressValue), 30);
InnerStartPercentPosition = new PercentPosition
{
IsInner = true,
Alignment = LinePercentAlignment.Start
};
InnerCenterPercentPosition = new PercentPosition
{
IsInner = true,
Alignment = LinePercentAlignment.Center
};
InnerEndPercentPosition = new PercentPosition
{
IsInner = true,
Alignment = LinePercentAlignment.End
};
public static readonly StyledProperty<string> ToggleDisabledTextProperty =
AvaloniaProperty.Register<ProgressBarShowCase, string>(nameof(ToggleDisabledText), "Disable");
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 static readonly StyledProperty<bool> ToggleStatusProperty =
AvaloniaProperty.Register<ProgressBarShowCase, bool>(nameof(ToggleStatus), true);
public LinearGradientBrush TwoStopsGradientStrokeColor { get; set; }
public double ProgressValue
{
get => GetValue(ProgressValueProperty);
set => SetValue(ProgressValueProperty, value);
}
public LinearGradientBrush ThreeStopsGradientStrokeColor { get; set; }
public string ToggleDisabledText
{
get => GetValue(ToggleDisabledTextProperty);
set => SetValue(ToggleDisabledTextProperty, value);
}
public List<IBrush> StepsChunkBrushes { get; set; }
public bool ToggleStatus
{
get => GetValue(ToggleStatusProperty);
set => SetValue(ToggleStatusProperty, value);
}
public PercentPosition InnerStartPercentPosition { get; set; }
public PercentPosition InnerCenterPercentPosition { get; set; }
public PercentPosition InnerEndPercentPosition { get; set; }
public ProgressBarShowCase()
{
InitializeComponent();
DataContext = this;
public PercentPosition OutterStartPercentPosition { get; set; }
public PercentPosition OutterCenterPercentPosition { get; set; }
public PercentPosition OutterEndPercentPosition { get; set; }
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)
};
public double ProgressValue
{
get => GetValue(ProgressValueProperty);
set => SetValue(ProgressValueProperty, value);
}
InnerStartPercentPosition = new PercentPosition()
{
IsInner = true,
Alignment = LinePercentAlignment.Start
};
InnerCenterPercentPosition = new PercentPosition()
{
IsInner = true,
Alignment = LinePercentAlignment.Center
};
InnerEndPercentPosition = new PercentPosition()
{
IsInner = true,
Alignment = LinePercentAlignment.End
};
public string ToggleDisabledText
{
get => GetValue(ToggleDisabledTextProperty);
set => SetValue(ToggleDisabledTextProperty, value);
}
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 bool ToggleStatus
{
get => GetValue(ToggleStatusProperty);
set => SetValue(ToggleStatusProperty, value);
}
public void AddProgressValue()
{
var value = ProgressValue;
value += 10;
ProgressValue = Math.Min(value, 100);
}
public void AddProgressValue()
{
var value = ProgressValue;
value += 10;
ProgressValue = Math.Min(value, 100);
}
public void SubProgressValue()
{
var value = ProgressValue;
value -= 10;
ProgressValue = Math.Max(value, 0);
}
public void SubProgressValue()
{
var value = ProgressValue;
value -= 10;
ProgressValue = Math.Max(value, 0);
}
public void ToggleEnabledStatus()
{
ToggleStatus = !ToggleStatus;
if (ToggleStatus) {
ToggleDisabledText = "Disable";
} else {
ToggleDisabledText = "Enable";
}
}
public void ToggleEnabledStatus()
{
ToggleStatus = !ToggleStatus;
if (ToggleStatus)
ToggleDisabledText = "Disable";
else
ToggleDisabledText = "Enable";
}
}

View File

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

View File

@ -4,30 +4,26 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class RadioButtonShowCase : UserControl
{
protected List<string> CheckRadios { get; set; }
public RadioButtonShowCase()
{
CheckRadios = new List<string>
{
"ToggleDisabledRadioUnChecked",
"ToggleDisabledRadioChecked"
};
InitializeComponent();
}
public RadioButtonShowCase()
{
CheckRadios = new List<string>()
{
"ToggleDisabledRadioUnChecked",
"ToggleDisabledRadioChecked"
};
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;
}
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 (radioBtn2 != null) {
radioBtn2.IsEnabled = !radioBtn2.IsEnabled;
}
}
if (radioBtn2 != null) radioBtn2.IsEnabled = !radioBtn2.IsEnabled;
}
}

View File

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

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class SegmentedShowCase : UserControl
{
public SegmentedShowCase()
{
InitializeComponent();
}
public SegmentedShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class SeparatorShowCase : UserControl
{
public SeparatorShowCase()
{
InitializeComponent();
}
public SeparatorShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -8,36 +8,36 @@ 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<AvaloniaList<SliderMark>?> SliderMarksProperty =
AvaloniaProperty.Register<SliderShowCase, AvaloniaList<SliderMark>?>(nameof(SliderMarks));
public static readonly StyledProperty<bool> NormalDisabledProperty =
AvaloniaProperty.Register<SliderShowCase, bool>(nameof(NormalEnabled), true);
public static readonly StyledProperty<bool> NormalDisabledProperty =
AvaloniaProperty.Register<SliderShowCase, bool>(nameof(NormalEnabled), true);
public SliderShowCase()
{
InitializeComponent();
SliderMarks = new AvaloniaList<SliderMark>();
SliderMarks.Add(new SliderMark("0°C", 0));
SliderMarks.Add(new SliderMark("26°C", 26));
SliderMarks.Add(new SliderMark("37°C", 37));
SliderMarks.Add(new SliderMark("100°C", 100)
{
LabelFontWeight = FontWeight.Bold,
LabelBrush = new SolidColorBrush(Colors.Red)
});
DataContext = this;
}
public AvaloniaList<SliderMark>? SliderMarks {
get => GetValue(SliderMarksProperty);
set => SetValue(SliderMarksProperty, value);
}
public bool NormalEnabled {
get => GetValue(NormalDisabledProperty);
set => SetValue(NormalDisabledProperty, value);
}
public SliderShowCase()
{
InitializeComponent();
SliderMarks = new AvaloniaList<SliderMark>();
SliderMarks.Add(new SliderMark("0°C", 0));
SliderMarks.Add(new SliderMark("26°C", 26));
SliderMarks.Add(new SliderMark("37°C", 37));
SliderMarks.Add(new SliderMark("100°C", 100)
{
LabelFontWeight = FontWeight.Bold,
LabelBrush = new SolidColorBrush(Colors.Red)
});
DataContext = this;
}
public AvaloniaList<SliderMark>? SliderMarks
{
get => GetValue(SliderMarksProperty);
set => SetValue(SliderMarksProperty, value);
}
public bool NormalEnabled
{
get => GetValue(NormalDisabledProperty);
set => SetValue(NormalDisabledProperty, value);
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class SplitButtonShowCase : UserControl
{
public SplitButtonShowCase()
{
InitializeComponent();
}
public SplitButtonShowCase()
{
InitializeComponent();
}
}

View File

@ -6,31 +6,25 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class SwitchShowCase : UserControl
{
public SwitchShowCase()
{
InitializeComponent();
}
public SwitchShowCase()
{
InitializeComponent();
}
public static void ToggleDisabledStatus(object arg)
{
var switchBtn = (arg as ToggleSwitch)!;
switchBtn.IsEnabled = !switchBtn.IsEnabled;
}
public static void ToggleLoadingStatus(object arg)
{
var btn = (arg as Button)!;
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 (toggleSwitchSmall is not null) {
toggleSwitchSmall.IsLoading = !toggleSwitchSmall.IsLoading;
}
}
public static void ToggleDisabledStatus(object arg)
{
var switchBtn = (arg as ToggleSwitch)!;
switchBtn.IsEnabled = !switchBtn.IsEnabled;
}
public static void ToggleLoadingStatus(object arg)
{
var btn = (arg as Button)!;
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 (toggleSwitchSmall is not null) toggleSwitchSmall.IsLoading = !toggleSwitchSmall.IsLoading;
}
}

View File

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

View File

@ -8,180 +8,185 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TabControlShowCase : UserControl
{
#region TabStrip
public TabControlShowCase()
{
InitializeComponent();
DataContext = this;
PositionTabStripOptionGroup.OptionCheckedChanged += HandleTabStripPlacementOptionCheckedChanged;
PositionCardTabStripOptionGroup.OptionCheckedChanged += HandleCardTabStripPlacementOptionCheckedChanged;
SizeTypeTabStripOptionGroup.OptionCheckedChanged += HandleTabStripSizeTypeOptionCheckedChanged;
AddTabDemoStrip.AddTabRequest += HandleTabStripAddTabRequest;
public static readonly StyledProperty<Dock> PositionTabStripPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionTabStripPlacement), Dock.Top);
public static readonly StyledProperty<Dock> PositionCardTabStripPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionCardTabStripPlacement), Dock.Top);
public static readonly StyledProperty<SizeType> SizeTypeTabStripProperty =
AvaloniaProperty.Register<TabControlShowCase, SizeType>(nameof(SizeTypeTabStrip), SizeType.Middle);
public Dock PositionTabStripPlacement
{
get => GetValue(PositionTabStripPlacementProperty);
set => SetValue(PositionTabStripPlacementProperty, value);
}
public Dock PositionCardTabStripPlacement
{
get => GetValue(PositionCardTabStripPlacementProperty);
set => SetValue(PositionCardTabStripPlacementProperty, value);
}
public SizeType SizeTypeTabStrip
{
get => GetValue(SizeTypeTabStripProperty);
set => SetValue(SizeTypeTabStripProperty, value);
}
#endregion
#region TabControl
public static readonly StyledProperty<Dock> PositionTabControlPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionTabControlPlacement), Dock.Top);
public static readonly StyledProperty<Dock> PositionCardTabControlPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionCardTabControlPlacement), Dock.Top);
public static readonly StyledProperty<SizeType> SizeTypeTabControlProperty =
AvaloniaProperty.Register<TabControlShowCase, SizeType>(nameof(SizeTypeTabControl), SizeType.Middle);
public Dock PositionTabControlPlacement
{
get => GetValue(PositionTabControlPlacementProperty);
set => SetValue(PositionTabControlPlacementProperty, value);
}
public Dock PositionCardTabControlPlacement
{
get => GetValue(PositionCardTabControlPlacementProperty);
set => SetValue(PositionCardTabControlPlacementProperty, value);
}
public SizeType SizeTypeTabControl
{
get => GetValue(SizeTypeTabControlProperty);
set => SetValue(SizeTypeTabControlProperty, value);
}
#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) {
PositionTabStripPlacement = Dock.Top;
} else if (args.Index == 1) {
PositionTabStripPlacement = Dock.Bottom;
} else if (args.Index == 2) {
PositionTabStripPlacement = Dock.Left;
} else {
PositionTabStripPlacement = Dock.Right;
}
}
private void HandleCardTabStripPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
PositionCardTabStripPlacement = Dock.Top;
} else if (args.Index == 1) {
PositionCardTabStripPlacement = Dock.Bottom;
} else if (args.Index == 2) {
PositionCardTabStripPlacement = Dock.Left;
} else {
PositionCardTabStripPlacement = Dock.Right;
}
}
private void HandleTabStripSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
SizeTypeTabStrip = SizeType.Small;
} else if (args.Index == 1) {
SizeTypeTabStrip = SizeType.Middle;
} else {
SizeTypeTabStrip = SizeType.Large;
}
}
private void HandleTabStripAddTabRequest(object? sender, RoutedEventArgs args)
{
var index = AddTabDemoStrip.ItemCount;
AddTabDemoStrip.Items.Add(new TabStripItem()
{
Content = $"new tab {index}",
IsClosable = true
});
}
#endregion
PositionTabControlOptionGroup.OptionCheckedChanged += HandleTabControlPlacementOptionCheckedChanged;
PositionCardTabControlOptionGroup.OptionCheckedChanged += HandleCardTabControlPlacementOptionCheckedChanged;
SizeTypeTabControlOptionGroup.OptionCheckedChanged += HandleTabControlSizeTypeOptionCheckedChanged;
AddTabDemoTabControl.AddTabRequest += HandleTabControlAddTabRequest;
}
#region TabControl
private void HandleTabControlPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
PositionTabControlPlacement = Dock.Top;
} else if (args.Index == 1) {
PositionTabControlPlacement = Dock.Bottom;
} else if (args.Index == 2) {
PositionTabControlPlacement = Dock.Left;
} else {
PositionTabControlPlacement = Dock.Right;
}
}
private void HandleCardTabControlPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
PositionCardTabControlPlacement = Dock.Top;
} else if (args.Index == 1) {
PositionCardTabControlPlacement = Dock.Bottom;
} else if (args.Index == 2) {
PositionCardTabControlPlacement = Dock.Left;
} else {
PositionCardTabControlPlacement = Dock.Right;
}
}
#region TabStrip
private void HandleTabControlSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0) {
SizeTypeTabControl = SizeType.Small;
} else if (args.Index == 1) {
SizeTypeTabControl = SizeType.Middle;
} else {
SizeTypeTabControl = SizeType.Large;
}
}
public static readonly StyledProperty<Dock> PositionTabStripPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionTabStripPlacement), Dock.Top);
private void HandleTabControlAddTabRequest(object? sender, RoutedEventArgs args)
{
var index = AddTabDemoTabControl.ItemCount;
AddTabDemoTabControl.Items.Add(new TabItem()
{
Header = $"new tab {index}",
Content = $"new tab content {index}",
IsClosable = true
});
}
#endregion
public static readonly StyledProperty<Dock> PositionCardTabStripPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionCardTabStripPlacement), Dock.Top);
public static readonly StyledProperty<SizeType> SizeTypeTabStripProperty =
AvaloniaProperty.Register<TabControlShowCase, SizeType>(nameof(SizeTypeTabStrip), SizeType.Middle);
public Dock PositionTabStripPlacement
{
get => GetValue(PositionTabStripPlacementProperty);
set => SetValue(PositionTabStripPlacementProperty, value);
}
public Dock PositionCardTabStripPlacement
{
get => GetValue(PositionCardTabStripPlacementProperty);
set => SetValue(PositionCardTabStripPlacementProperty, value);
}
public SizeType SizeTypeTabStrip
{
get => GetValue(SizeTypeTabStripProperty);
set => SetValue(SizeTypeTabStripProperty, value);
}
#endregion
#region TabControl
public static readonly StyledProperty<Dock> PositionTabControlPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionTabControlPlacement), Dock.Top);
public static readonly StyledProperty<Dock> PositionCardTabControlPlacementProperty =
AvaloniaProperty.Register<TabControlShowCase, Dock>(nameof(PositionCardTabControlPlacement), Dock.Top);
public static readonly StyledProperty<SizeType> SizeTypeTabControlProperty =
AvaloniaProperty.Register<TabControlShowCase, SizeType>(nameof(SizeTypeTabControl), SizeType.Middle);
public Dock PositionTabControlPlacement
{
get => GetValue(PositionTabControlPlacementProperty);
set => SetValue(PositionTabControlPlacementProperty, value);
}
public Dock PositionCardTabControlPlacement
{
get => GetValue(PositionCardTabControlPlacementProperty);
set => SetValue(PositionCardTabControlPlacementProperty, value);
}
public SizeType SizeTypeTabControl
{
get => GetValue(SizeTypeTabControlProperty);
set => SetValue(SizeTypeTabControlProperty, value);
}
#endregion
#region TabStrip
private void HandleTabStripPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
PositionTabStripPlacement = Dock.Top;
else if (args.Index == 1)
PositionTabStripPlacement = Dock.Bottom;
else if (args.Index == 2)
PositionTabStripPlacement = Dock.Left;
else
PositionTabStripPlacement = Dock.Right;
}
private void HandleCardTabStripPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
PositionCardTabStripPlacement = Dock.Top;
else if (args.Index == 1)
PositionCardTabStripPlacement = Dock.Bottom;
else if (args.Index == 2)
PositionCardTabStripPlacement = Dock.Left;
else
PositionCardTabStripPlacement = Dock.Right;
}
private void HandleTabStripSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
SizeTypeTabStrip = SizeType.Small;
else if (args.Index == 1)
SizeTypeTabStrip = SizeType.Middle;
else
SizeTypeTabStrip = SizeType.Large;
}
private void HandleTabStripAddTabRequest(object? sender, RoutedEventArgs args)
{
var index = AddTabDemoStrip.ItemCount;
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)
PositionTabControlPlacement = Dock.Top;
else if (args.Index == 1)
PositionTabControlPlacement = Dock.Bottom;
else if (args.Index == 2)
PositionTabControlPlacement = Dock.Left;
else
PositionTabControlPlacement = Dock.Right;
}
private void HandleCardTabControlPlacementOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
PositionCardTabControlPlacement = Dock.Top;
else if (args.Index == 1)
PositionCardTabControlPlacement = Dock.Bottom;
else if (args.Index == 2)
PositionCardTabControlPlacement = Dock.Left;
else
PositionCardTabControlPlacement = Dock.Right;
}
private void HandleTabControlSizeTypeOptionCheckedChanged(object? sender, OptionCheckedChangedEventArgs args)
{
if (args.Index == 0)
SizeTypeTabControl = SizeType.Small;
else if (args.Index == 1)
SizeTypeTabControl = SizeType.Middle;
else
SizeTypeTabControl = SizeType.Large;
}
private void HandleTabControlAddTabRequest(object? sender, RoutedEventArgs args)
{
var index = AddTabDemoTabControl.ItemCount;
AddTabDemoTabControl.Items.Add(new TabItem
{
Header = $"new tab {index}",
Content = $"new tab content {index}",
IsClosable = true
});
}
#endregion
}

View File

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

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TagShowCase : UserControl
{
public TagShowCase()
{
InitializeComponent();
}
public TagShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TimePickerShowCase : UserControl
{
public TimePickerShowCase()
{
InitializeComponent();
}
public TimePickerShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,9 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TimelineShowCase : UserControl
{
public TimelineShowCase()
{
InitializeComponent();
}
public TimelineShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TitleBarShowCase : UserControl
{
public TitleBarShowCase()
{
InitializeComponent();
}
public TitleBarShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class ToolBarShowCase : UserControl
{
public ToolBarShowCase()
{
InitializeComponent();
}
public ToolBarShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -6,45 +6,49 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TooltipShowCase : UserControl
{
public static readonly StyledProperty<bool> ShowArrowProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
public static readonly StyledProperty<bool> ShowArrowProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(ShowArrow), true);
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter), false);
public static readonly StyledProperty<bool> IsPointAtCenterProperty =
AvaloniaProperty.Register<TooltipShowCase, bool>(nameof(IsPointAtCenter));
private Segmented _segmented;
private readonly Segmented _segmented;
public bool ShowArrow
{
get => GetValue(ShowArrowProperty);
set => SetValue(ShowArrowProperty, 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;
}
};
}
public bool IsPointAtCenter
{
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;
}
};
}
public bool ShowArrow
{
get => GetValue(ShowArrowProperty);
set => SetValue(ShowArrowProperty, value);
}
public bool IsPointAtCenter
{
get => GetValue(IsPointAtCenterProperty);
set => SetValue(IsPointAtCenterProperty, value);
}
}

View File

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

View File

@ -5,37 +5,36 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class TreeViewShowCase : UserControl
{
public static readonly StyledProperty<bool> ShowLineSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLineSwitchChecked), true);
public static readonly StyledProperty<bool> ShowLineSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLineSwitchChecked), true);
public static readonly StyledProperty<bool> ShowIconSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowIconSwitchChecked), false);
public static readonly StyledProperty<bool> ShowIconSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowIconSwitchChecked));
public static readonly StyledProperty<bool> ShowLeafSwitcherSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLeafSwitcherSwitchChecked), false);
public static readonly StyledProperty<bool> ShowLeafSwitcherSwitchCheckedProperty =
AvaloniaProperty.Register<TreeViewShowCase, bool>(nameof(ShowLeafSwitcherSwitchChecked));
public bool ShowLineSwitchChecked
{
get => GetValue(ShowLineSwitchCheckedProperty);
set => SetValue(ShowLineSwitchCheckedProperty, value);
}
public TreeViewShowCase()
{
InitializeComponent();
DataContext = this;
}
public bool ShowIconSwitchChecked
{
get => GetValue(ShowIconSwitchCheckedProperty);
set => SetValue(ShowIconSwitchCheckedProperty, value);
}
public bool ShowLineSwitchChecked
{
get => GetValue(ShowLineSwitchCheckedProperty);
set => SetValue(ShowLineSwitchCheckedProperty, value);
}
public bool ShowLeafSwitcherSwitchChecked
{
get => GetValue(ShowLeafSwitcherSwitchCheckedProperty);
set => SetValue(ShowLeafSwitcherSwitchCheckedProperty, value);
}
public TreeViewShowCase()
{
InitializeComponent();
DataContext = this;
}
public bool ShowIconSwitchChecked
{
get => GetValue(ShowIconSwitchCheckedProperty);
set => SetValue(ShowIconSwitchCheckedProperty, value);
}
public bool ShowLeafSwitcherSwitchChecked
{
get => GetValue(ShowLeafSwitcherSwitchCheckedProperty);
set => SetValue(ShowLeafSwitcherSwitchCheckedProperty, value);
}
}

View File

@ -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&#x000A;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&#x000A;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>

View File

@ -4,8 +4,8 @@ namespace AtomUI.Demo.Desktop.ShowCase;
public partial class WatermarkShowCase : UserControl
{
public WatermarkShowCase()
{
InitializeComponent();
}
public WatermarkShowCase()
{
InitializeComponent();
}
}

View File

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

View File

@ -1,28 +1,26 @@
using Avalonia.Markup.Xaml;
namespace AtomUI.Demo.Desktop.Utils
namespace AtomUI.Demo.Desktop.Utils;
/// <summary>
/// Xaml markup to get the enum values.
/// </summary>
/// TODO 优化性能时可以考虑缓存类型和列表
public class EnumExtension : MarkupExtension
{
/// <summary>
/// Xaml markup to get the enum values.
/// </summary>
/// TODO 优化性能时可以考虑缓存类型和列表
public class EnumExtension : MarkupExtension
public EnumExtension(Type type)
{
[ConstructorArgument(nameof(Type))]
public Type Type { get; set; }
Type = type;
}
public EnumExtension(Type type)
{
Type = type;
}
[ConstructorArgument(nameof(Type))] public Type Type { get; set; }
public override object ProvideValue(IServiceProvider serviceProvider)
{
// Issue I7:
// Array can not perform well for Items of ListBox.
// Version : 11.0.0-preview4
// By nlb at 2023.3.28.
return Enum.GetValues(Type).OfType<object>().ToList();
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
// Issue I7:
// Array can not perform well for Items of ListBox.
// Version : 11.0.0-preview4
// By nlb at 2023.3.28.
return Enum.GetValues(Type).OfType<object>().ToList();
}
}

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