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"/>
CodePudding user response:
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
.
See also here: Visual Studio - Resx File default 'internal' to 'public'