mirror of
https://github.com/Crunchy-DL/Crunchy-Downloader.git
synced 2026-04-20 16:32:07 +00:00
14 lines
No EOL
531 B
C#
14 lines
No EOL
531 B
C#
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
|
|
namespace CRD.Utils.UI;
|
|
|
|
public class UiEmptyToDefaultConverter: IValueConverter{
|
|
public object? Convert(object? value, System.Type targetType, object? parameter, CultureInfo culture){
|
|
var s = value as string;
|
|
var fallback = parameter as string ?? string.Empty;
|
|
return string.IsNullOrEmpty(s) ? fallback : s!;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, System.Type targetType, object? parameter, CultureInfo culture) => value!;
|
|
} |