Ionite
1 year ago
2 changed files with 34 additions and 1 deletions
@ -0,0 +1,28 @@ |
|||||||
|
using System; |
||||||
|
using System.Globalization; |
||||||
|
using Avalonia.Data.Converters; |
||||||
|
|
||||||
|
namespace StabilityMatrix.Avalonia.Converters; |
||||||
|
|
||||||
|
public class CultureInfoDisplayConverter : IValueConverter |
||||||
|
{ |
||||||
|
/// <inheritdoc /> |
||||||
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) |
||||||
|
{ |
||||||
|
if (value is not CultureInfo cultureInfo) |
||||||
|
return null; |
||||||
|
|
||||||
|
return cultureInfo.TextInfo.ToTitleCase(cultureInfo.NativeName); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc /> |
||||||
|
public object ConvertBack( |
||||||
|
object? value, |
||||||
|
Type targetType, |
||||||
|
object? parameter, |
||||||
|
CultureInfo culture |
||||||
|
) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue