KTDReaderGUI Init + BeWo.Styles seperates Projekt -> Eigene Testanwendungen
This commit is contained in:
37
BeWo.Styles/Converters/EnumTranslationConverter.cs
Normal file
37
BeWo.Styles/Converters/EnumTranslationConverter.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using BS.Shared.Core;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BeWo.Styles.Converters
|
||||
{
|
||||
public class EnumTranslationConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Enum e)
|
||||
{
|
||||
if (EnumTranslations.Wohnhilfe2Translation.TryGetValue(e, out string v))
|
||||
{
|
||||
return v;
|
||||
}
|
||||
// RE:
|
||||
// EnumTranslationConverter, aber betrachtet nicht alle?
|
||||
// Brauche hier eig nur EnumTranslations.Gkv2Translation
|
||||
if (EnumTranslations.AllTranslations.TryGetValue(e, out string vv))
|
||||
{
|
||||
return vv;
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user