fix: fix invisible issue when Dot=True & fix some style issues in Badge.

This commit is contained in:
Zhang Dian
2025-01-15 22:58:21 +08:00
parent e57036163d
commit 63be2d15ad
3 changed files with 35 additions and 8 deletions

View File

@@ -3,18 +3,19 @@ using Avalonia.Data.Converters;
namespace Ursa.Converters;
public class BadgeContentOverflowConverter: IMultiValueConverter
public class BadgeContentOverflowConverter : IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
string overflowMark = parameter is string s ? s : "+";
if (double.TryParse(values[0]?.ToString(), out var b) && values[1] is int i and > 0)
var overflowMark = parameter as string ?? "+";
if (double.TryParse(values[0]?.ToString(), out var b) && values[1] is int count and > 0)
{
if (b > i)
if (b > count)
{
return i + overflowMark;
return $"{count}{overflowMark}";
}
}
return values[0];
}
}