I have a few images in a folder 'Images' in my solution. From within a class in my library I would like to decide which image I should use at runtime. The old way i would do this from within a user control's code behind is by loading all of the images in the class's constructor like so:
myImage = FindResource("MyImageResource") as BitmapImage;
Then determining at runtime which image to use.
But this doesn't seem to work from within any class in my class library not to mention it seems to go against all that I've read about MVVM.
A bit more information on what i am trying to do Essentially i have a model class which stores all of the information on a drive which has been inserted such as drive type and its name.
A view model class which monitors when any drive is inserted or removed.
And the view class which is a panel that holds a collection of buttons resembling the drives of the system.
To Clarify my question:
How should i store and load images in a WPF class library?
In which class should i determine (at runtime) which image to use (in the MVVM pattern)?