What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Help] BitmapImage local relative path file

taozi

Community Developer
Joined
Nov 10, 2012
Messages
163
Reaction score
1
I am updating my plugin, I have some image files in images folder under plugin directory, I can show image using absolute path as following:

Code:
                        btnImage3 = new Button
							{
								Width = 24,
								HorizontalAlignment = HorizontalAlignment.Center,
								VerticalAlignment = VerticalAlignment.Top,
								Margin = new Thickness(3),								 
								Content = new Image
									{
										Source = new BitmapImage(new Uri(@"h:\demonbuddy\Plugins\ItemCount\images\3.png")),
										VerticalAlignment = VerticalAlignment.Center
									}					
							};

but if I use relative file path as following, I can not show the image, I can not use absolute file path for a plugin since people install demonbuddy in different places, can some one help me out?

Code:
                        btnImage3 = new Button
							{
								Width = 24,
								HorizontalAlignment = HorizontalAlignment.Center,
								VerticalAlignment = VerticalAlignment.Top,
								Margin = new Thickness(3),								 
								Content = new Image
									{
										Source = new BitmapImage(new Uri(@"images/3.png",UriKind.Relative)),
										VerticalAlignment = VerticalAlignment.Center
									}
							};

[Update] still can not figure out the way to use relative file path, for now, I just use absolute file path, already updated my plugin, but still, it doesn't hurt to know the answer:

E8FHdfB.png
 
Last edited:
Back
Top