21 lines
622 B
C#
21 lines
622 B
C#
using System.Collections;
|
|
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
|
|
namespace ModpackUpdater.Apps.Manager;
|
|
|
|
public class DictionaryValueConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (parameter is IDictionary dict && value != null && dict.Contains(value))
|
|
return dict[value];
|
|
return value?.ToString() ?? string.Empty;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|