🍆 topissime amélioration

master
Marc CHEVALDONNE 3 months ago
parent e544812c48
commit 91112de05f

@ -17,18 +17,6 @@ public class AppResourcesVM : INotifyPropertyChanged
AppResources.Culture = value;
OnPropertyChanged("Culture");
OnPropertyChanged("ButtonText");
OnPropertyChanged("EntryPlaceholder");
OnPropertyChanged("LabelText");
OnPropertyChanged("PickerText");
}
}
public string ButtonText => AppResources.ButtonText;
public string EntryPlaceholder => AppResources.EntryPlaceholder;
public string LabelText => AppResources.LabelText;
public string PickerText => AppResources.PickerText;
}

@ -1,5 +1,6 @@
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
namespace ex_Localization3.Resources.Localization;
@ -43,10 +44,9 @@ public class LocalizedStringExtension : IMarkupExtension<string>
IProvideValueTarget? provideValueTarget = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
CultureChanged += (src, args) =>
{
(provideValueTarget?.TargetObject as BindableObject)?.SetValue((provideValueTarget?.TargetProperty as BindableProperty), typeof(AppResourcesVM).GetProperty(Key)?.GetValue(AppRes) as string ?? "");
(provideValueTarget?.TargetObject as BindableObject)?.SetValue((provideValueTarget?.TargetProperty as BindableProperty), typeof(AppResources).GetProperty(Key, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as string ?? "");
};
return typeof(AppResourcesVM).GetProperty(Key)?.GetValue(AppRes) as string ?? "";
return typeof(AppResources).GetProperty(Key, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as string ?? "";
}
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)

Loading…
Cancel
Save