feat: add icon selector demo.

This commit is contained in:
rabbitism
2023-12-27 01:27:07 +08:00
parent 0c4b6edfc2
commit 3e95f191a0
5 changed files with 82 additions and 9 deletions

View File

@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using Avalonia;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Ursa.Controls;
namespace Ursa.Demo.Converters;
public class TimelineIconConverter: IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is TimelineItemType t)
{
return t switch
{
TimelineItemType.Success => Brushes.Green,
TimelineItemType.Ongoing => Brushes.Blue,
TimelineItemType.Error => Brushes.Red,
_ => Brushes.Gray
};
}
return AvaloniaProperty.UnsetValue;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}