Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone
i have 3 BitmapImage in my resources like this :
XML
<BitmapImage x:Key="ImageSource_1" CreateOptions="IgnoreImageCache" CacheOption="OnLoad" UriSource="E:\Original Compiler\VIS Management\VIS Management\VIS Management\Images\BrowsersIcons\1.jpg"/>
		<BitmapImage x:Key="ImageSource_2" CreateOptions="IgnoreImageCache" CacheOption="OnLoad" UriSource="E:\Original Compiler\VIS Management\VIS Management\VIS Management\Images\BrowsersIcons\2.jpg"/>
		<BitmapImage x:Key="ImageSource_E3" CreateOptions="IgnoreImageCache" CacheOption="OnLoad" UriSource="E:\Original Compiler\VIS Management\VIS Management\VIS Management\Images\BrowsersIcons\3.jpg"/>


I have a list and it has a field "Imagename" and it give to me a number from 1 to 3
Now i want get it number and convert it to my resources
but how can i do?
thank you
Posted
Updated 9-May-13 4:12am
v3

1 solution

This might give you a starting point,

http://stackoverflow.com/questions/14259262/implementing-ivalueconverter-to-convert-string-to-image[^]

You will want to look at how to access resources within a resource dictionary through code as well because that will be how to retrieve the image.
 
Share this answer
 
Comments
Sina asefi 9-May-13 10:26am    
First thank you for your response
it just explain about how can we convert a string address to image
but i get a number like 1 or 2 or 3 and i want return a staticresource by it
Pheonyx 9-May-13 10:30am    
In the value converter you create a switch statement for the object, if it is value 1, return the appropriate image, value 2, return appropriate image etc.
Sina asefi 9-May-13 10:38am    
I know i can use from this
Return New BitmapImage(New Uri("pack://application:,,,/Images/Icons/1.jpg"))
but i made 3 BitmapImage in my resourcedictionary and i want access to them Instead of direct access to files!
do you know how can i do that?
Pheonyx 9-May-13 10:57am    
Someone here appears to be doing something similar, they are accessing a template rather than an image but I believe the principle should be similar.

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e2001a25-9ce2-4421-96b7-3dd42b601f1a/

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