Tuesday, 12 November 2013

Common Code - UriStringSpeller - BitmapImage from String

Occasionally you will need to get a BitmapImage for toolbar or other UI controls. If these images are already embedded as a Resource (this is a build action in Visual Studio) you will need some way to specify the Uri for the BitmapImage. WPF has a fairly unusual looking notation for this so I created a helper class call UriStringSpeller. The class has two methods, one assumes the image is in the same assembly as the UriStringSpeller and the other allows you to specify an alternative assembly. I have a lot of common images so the first method is useful for those since they sit in the same assembly.


No comments:

Post a Comment