问题
As I have discovered, I do not seem to have access to the mentioned functions. I am importing the BitmapImage class from
using System.Windows.Media.Imaging;
however in the following code:
public static void loadCardImage(Card card, ref Image image)
{
BitmapImage src = new BitmapImage();
src.BeginInit(); <--Cannot find this function
src.UriSource = new Uri(card.imageLink, UriKind.Relative); <-- this is fine
[..NotFinishedCoding..]
}
I get a parser error and a build error on the src.BeginInit() function. I seem to also be missing the EndInit() function and probably more functions inside that class. I have consulted the documentation to see if I screwed up the import or am refering to some other class, but as far as I can see I am referring to the correct class. (hovering over it reveals it is referring to System.Windows.Media.Imaging.BitmapImage class)
Any ideas on what might be going on? Any help is greatly appreciated please let me know if more information is necessary!
Refereed documentation: http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.aspx
Windows Phone OS is set to 8 (I assume it uses .NET 4.5)
回答1:
Here's the Windows Phone version of BitmapImage. It can be a bit confusing to find the Windows Phone versions of classes, etc. - I usually do a search from dev.windowsphone.com and limit the results to "Library".
来源:https://stackoverflow.com/questions/13893837/bitmapimage-missing-begininit-and-endinit-function