-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to binding general string indexers? #10033
Comments
Maybe Markup Extensions fit your needs: https://devblogs.microsoft.com/ifdef-windows/use-a-custom-resource-markup-extension-to-succeed-at-ui-string-globalization/ |
This article does not seem to implement the code for dynamically switching languages |
@RedTellYou Not an answer for you question but if you want to dynamically switch languages, try the WinUI3Localizer (Diclosure: I'm the author.). |
@whiskhub @AndrewKeepCoding My project requires WPF and WinUI3 to share MVVM, so I can only consider how to achieve multi-language compatibility. The methods you provide can only be used in WinUI3, not in WPF. |
I have a general language change singleton class
public class LanguageManager : INotifyPropertyChanged
{
private readonly ResourceManager _resourceManager;
private static readonly Lazy Lazy = new(() => new LanguageManager());
public static LanguageManager Instance => Lazy.Value;
}
In WPF you can do this:
<TextBlockText="{Binding [Welcome], Source={x:Static localization:LanguageManager.Instance}}" />
But this cannot be done in WinUI3:
<TextBlock Text="{Binding [Welcome], Source={x:Static localization:LanguageManager.Instance}}" />
So, In winui3, How to do?
The text was updated successfully, but these errors were encountered: