This commit is contained in:
Dan Clark
2024-11-24 16:35:00 +00:00
parent 911ed375b4
commit d893335195
18 changed files with 282 additions and 200 deletions
+4 -11
View File
@@ -4,24 +4,17 @@ using System.Globalization;
namespace Toolkit.UI.WinUI;
public class StringFormatConverter :
ValueConverter<object, object>
ValueConverter<object?, object?>
{
public string? StringFormat { get; set; }
protected override object? ConvertTo(object value,
protected override object? ConvertTo(object? value,
Type? targetType,
object? parameter,
string? language)
{
if (value is null)
{
return null!;
}
if (string.IsNullOrEmpty(StringFormat))
{
return value.ToString()!;
}
if (value is null) return null!;
if (StringFormat is not { Length: > 0}) return $"{value}"!;
try
{