Hi,
I have a TranslateExtension that I use in Avalonia, and WPF to translate some stuff, the code is pretty simple.
public class TranslateExtension : MarkupExtension
{
public TranslateExtension(string key)
{
this.Key = key;
}
public string Key { get; set; }
public string FallBack { get; set; }
public string Context { get; set; }
public override object ProvideValue(IServiceProvider serviceProvider)
{
....
var binding = new BindingExtension($"[{keyToUse}]")
{
Mode = BindingMode.OneWay,
Source = Translator.Instance,
FallbackValue = fallback,
};
return binding.ProvideValue(serviceProvider);
}
}
Bascialy, when the is no translation for a specific key (returns null), a fallback value is used instead.
This extension works fine with WPF, and Avalonia 0.8.3.
The problem occurs with the latest version 0.9 preview 3, where it seems that it's ignoring the FallbackValue
Repro project: https://github.com/braca/avalonia-binding-fallback-bug
You can load my repro project, with 0.8.3 it will work perfectly, if you update to the latest 0.9 preview 3, the fallback value won't be used.
Note: When you update to the latest preview, comment this using Portable.Xaml.Markup; in TranslateExtensions.cs
Hi,
I have a TranslateExtension that I use in Avalonia, and WPF to translate some stuff, the code is pretty simple.
Bascialy, when the is no translation for a specific key (returns null), a fallback value is used instead.
This extension works fine with WPF, and Avalonia 0.8.3.
The problem occurs with the latest version 0.9 preview 3, where it seems that it's ignoring the
FallbackValueRepro project: https://github.com/braca/avalonia-binding-fallback-bug
You can load my repro project, with 0.8.3 it will work perfectly, if you update to the latest 0.9 preview 3, the fallback value won't be used.
Note: When you update to the latest preview, comment this
using Portable.Xaml.Markup;inTranslateExtensions.cs