diff --git a/StabilityMatrix.Avalonia/Converters/CultureInfoDisplayConverter.cs b/StabilityMatrix.Avalonia/Converters/CultureInfoDisplayConverter.cs new file mode 100644 index 00000000..d51a3d0a --- /dev/null +++ b/StabilityMatrix.Avalonia/Converters/CultureInfoDisplayConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using Avalonia.Data.Converters; + +namespace StabilityMatrix.Avalonia.Converters; + +public class CultureInfoDisplayConverter : IValueConverter +{ + /// + 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); + } + + /// + public object ConvertBack( + object? value, + Type targetType, + object? parameter, + CultureInfo culture + ) + { + throw new NotImplementedException(); + } +} diff --git a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml index 21ab36ac..7a1e324f 100644 --- a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml +++ b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml @@ -10,12 +10,17 @@ xmlns:ui="using:FluentAvalonia.UI.Controls" xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels" xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" + xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters" d:DataContext="{x:Static mocks:DesignData.SettingsViewModel}" d:DesignHeight="700" d:DesignWidth="800" x:CompileBindings="True" x:DataType="vm:SettingsViewModel" mc:Ignorable="d"> + + + + @@ -46,7 +51,7 @@