Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Sir,
I am new in wpf application and want to use the label content property to use for its text from resources.resx which is inside properties in wpf application.
Updated 26-Jan-14 20:29pm
Sergey Alexandrovich Kryukov 27-Jan-14 2:30am    
What have you tried so far?

1 solution

Create string resource item in your resx. The resx note in Visual Studio has a sub-node with auto-generated code. Open this file. You will find a static class member with the name identical or close to the name of your string resource. Use it immediately:
System.Windows.Controls.Label myLabel = //... usually generated in your *.xaml.cs file; or create it by yourself in code


myLabel.Text = Resource.MyResource.MyLabel; // find exact name from the file I mentioned above

The alternative is using XAML resources instead of resx. Unfortunately, it won't give you auto-generated code file, but then you would be able to use the resources in your XAML of your windows, pages or user controls. Please see:[^],[^],[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900