problem loading resource from class library
- by mishal153
I have a class library (mylibrary) which has a resource called "close.png". I used redGate reflector to confirm that the resource is actually present in the dll.
Now i use mylibrary.dll in a project where i attempt to extract this "close.png" resource like this :
BitmapImage crossImage = new BitmapImage();
crossImage.BeginInit();
crossImage.UriSource = new Uri(@"/mylibrary;component/Resources/close.png", UriKind.RelativeOrAbsolute);
crossImage.EndInit();
This BitmapImage crossImage is then used like :
Button closeButton = new Button()
{
Content = new System.Windows.Controls.Image()
{
Source = crossImage
},
MaxWidth = 20,
MaxHeight = 20
};
On doing this i get no exceptions being thrown but the button shows no image.
Also, i do see some exception info if i investigate the button's 'content' in the debugger.