Add another example app

This commit is contained in:
Daniel Clark
2022-11-03 12:33:23 +00:00
parent 854d393b43
commit c601957dd9
38 changed files with 1070 additions and 30 deletions
@@ -0,0 +1,37 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
namespace TheXamlGuy.UI.Avalonia.Controls
{
public class ProgressRing : RangeBase
{
public static readonly StyledProperty<bool> IsIndeterminateProperty =
AvaloniaProperty.Register<ProgressRing, bool>(nameof(IsIndeterminate), true);
public bool IsIndeterminate
{
get => GetValue(IsIndeterminateProperty);
set => SetValue(IsIndeterminateProperty, value);
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs args)
{
UpdateIsIndeterminate();
}
private void UpdateIsIndeterminate()
{
PseudoClasses.Set(":indeterminate", IsIndeterminate);
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == IsIndeterminateProperty)
{
UpdateIsIndeterminate();
}
}
}
}