1

I'm trying to make an interface with multiple language options on a WPF screen. I'm writing the name of the text block I want to add to my Resources file and my code, but on the xaml screen "The member "Manuals" is not recognized or is not accessible." I get an error. I am getting this error in all the buttons and texts I try to add. Can you help me understand why? There is my xaml code line and resources designer cs project code line. Thanks in advance.

public static string _Manual
    {
        get
        {
            return ResourceManager.GetString("Manuals", resourceCulture);
        }
    } 

<TextBlock  Name="ttbManuals" Grid.Row="8" Text="{x:Static resx:Resources._Manual}" HorizontalAlignment="Left" Margin="0,0,0,-20"  VerticalAlignment="Top" Height="39" Width="580" Style="{DynamicResource CncTextBlock}" Background="{DynamicResource BackgroundBrush1}" Padding="10,5,0,0"/>
  

            
  • Please take a look at https://stackoverflow.com/help/how-to-ask, especially the section *DO NOT post images of code, data, error messages, etc.* – Clemens Jul 22 '22 at 08:11
  • ResourceManager has access to the content of a *.resx file. If you want the string value of a resource named "Manuals" "Manuals" needs to have been added to the resx file the manager wraps around. If your "Manuals" is the name of a WPF textbox, it won't work. The content of a WPF Textbox is accessed very straight forwardly through `myTextBox.Text`. In your case `Manuals.Text`. – lidqy Jul 22 '22 at 08:12
  • @Clemens sorry i am not very familiar with asking questions on stacoverflow i will be careful. – Rabia Kıran Jul 22 '22 at 08:22
  • Then edit your question please. – Clemens Jul 22 '22 at 08:31
  • resx file with the same name, but the textbox name is different. I checked many times to see if there is something I wrote differently, but I couldn't find it. @lidqy – Rabia Kıran Jul 22 '22 at 08:32
  • I hope it's better this way. @Clemens – Rabia Kıran Jul 22 '22 at 08:40

1 Answers1

1

The Resources class is by default created as internal. For use in XAML it needs however to be public.

To fix it, select the resx file in solution explorer and in the properties, change ResXFileCodeGenerator to PublicResXFileCodeGenerator.

enter image description here

See also here: Visual Studio - Resx File default 'internal' to 'public'

Klaus Gütter
  • 11,151
  • 6
  • 31
  • 36