Designer window default not showing when creating translation function using MarkupExtension

Viewed 23

I am making a language conversion program by referring to this link.

https://www.wpftutorial.net/LocalizeMarkupExtension.html

When I run the program, it works without problems, but the default values are not displayed in the designer window.

-. A resource file was created for each language requiring translation.

-. I copied the cs file of the file received from the link.

Created a label that needs translation as shown below.

<Label Name="MainWindow_Language_Status" Content="{ex:Translate MainWindow_Language_Status}" Foreground="Black" Grid.Column="4"/>

However, the default value does not appear in the designer window.

enter image description here

I've been struggling with this problem all day.

I want to find the cause, but I can't figure out what the problem is.

Please help. Thanks

  1. I thought the default language setting was the problem, so I tried changing the default language in assembly, but it was the same. [assembly: NeutralResourcesLanguage("ko-KR", UltimateResourceFallbackLocation.Satellite)]
  2. Setting the binding default seems to be the problem, so I tried adding a default property, but it was the same.
public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var binding = new Binding("Value")
            {
                Source = new TranslationData(_key)
            };
            return binding.ProvideValue(serviceProvider);
        }
public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var binding = new Binding("Value")
            {
                Source = new TranslationData(_key),
                FallbackValue = _key,    //Added
            };
            return binding.ProvideValue(serviceProvider);
        }
0 Answers
Related