Click here to Skip to main content
15,904,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 , and i am looking for such solution which trough i can use this on property or in entire application so that whenever i create any window i don't need to add such reference on every page,

please provide me solution asap.

thanks
Posted
Updated 24-Jan-14 23:54pm
v2

1 solution

Hi.Do following:
1- In the solution explorer open Properties and then open Resources.Resx
2- Now add your specified image.
3- Change its access modifier from internal into public.
4- Now in your Solution Explorer is added a folder that namd "Resources".
5- Open it and press F4 to see properties of your image. then set its Build Action to Resources.
6- Open App.Xaml and write following XAML code:
XML
<Application.Resources>
        <ResourceDictionary>
            <BitmapImage x:Key="TestImage" UriSource="/YourProjectNamespace;component/Resources/YourImageName.png"/>
        </ResourceDictionary>
    </Application.Resources>

7- any where you can use it by referene it:
<Image Source="{StaticResource TestImage}"/>
 
Share this answer
 
v2
Comments
vishvadeepak 25-Jan-14 7:27am    
sir i want to add value from .resx file into content property of label and want to add this resx file reference to the place from where i can get reference in all window of my project.Please help me sir.
aliwpf 25-Jan-14 10:33am    
hi. you must substitute Source with Content.
vishvadeepak 25-Jan-14 7:29am    
sir i want to add value of .resx file into content of label and want to add .resx reference to the place where i can use its instance in each window of the project. please sir help me.

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