Is it possible to add some value from resource file right into the XAML markup? Or for localization we always have to make something like this in *.cs file:
txtMessage.Text = Messages.WarningUserMessage;
Where Messages
is resource, and txtMessage
is TextBlock.
Right Click the Project select Add New Item -> General -> Resource File.
The . resx resource file format consists of XML entries that specify objects and strings inside XML tags. One advantage of a . resx file is that when opened with a text editor (such as Notepad) it can be written to, parsed, and manipulated.
Net Resource (. resx) files are a monolingual file format used in Microsoft . Net Applications. The . resx resource file format consists of XML entries, which specify objects and strings inside XML tags.
Make sure that Code Generation is set to Public in the resx editor, then you can simply use:
<TextBlock Text="{x:Static Messages.WarningUserMessage}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With