Merge pull request #419 from irihitech/loading

Introducing background and foreground for LoadingContainer
This commit is contained in:
Dong Bin
2024-09-22 19:12:09 +08:00
committed by GitHub
4 changed files with 40 additions and 19 deletions

View File

@@ -14,10 +14,10 @@ public class Loading: ContentControl
set => SetValue(IndicatorProperty, value);
}
public static readonly StyledProperty<object?> IsLoadingProperty = AvaloniaProperty.Register<Loading, object?>(
public static readonly StyledProperty<bool> IsLoadingProperty = AvaloniaProperty.Register<Loading, bool>(
nameof(IsLoading));
public object? IsLoading
public bool IsLoading
{
get => GetValue(IsLoadingProperty);
set => SetValue(IsLoadingProperty, value);

View File

@@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Templates;
using Avalonia.Media;
namespace Ursa.Controls;
@@ -28,6 +29,15 @@ public class LoadingContainer: ContentControl
set => SetValue(LoadingMessageProperty, value);
}
public static readonly StyledProperty<IBrush?> MessageForegroundProperty = AvaloniaProperty.Register<LoadingContainer, IBrush?>(
nameof(MessageForeground));
public IBrush? MessageForeground
{
get => GetValue(MessageForegroundProperty);
set => SetValue(MessageForegroundProperty, value);
}
public static readonly StyledProperty<IDataTemplate> LoadingMessageTemplateProperty = AvaloniaProperty.Register<LoadingContainer, IDataTemplate>(
nameof(LoadingMessageTemplate));

View File

@@ -1,8 +1,16 @@
using Avalonia;
using Avalonia.Controls;
namespace Ursa.Controls;
public class LoadingIcon: ContentControl
{
public static readonly StyledProperty<bool> IsLoadingProperty = AvaloniaProperty.Register<LoadingIcon, bool>(
nameof(IsLoading));
public bool IsLoading
{
get => GetValue(IsLoadingProperty);
set => SetValue(IsLoadingProperty, value);
}
}