R – Load File in XAP

silverlight

I had a number of CSV files embedded within a Silverlight DLL (as Resource). I need to move these into the XAP (as Content rather than resource). The trouble is Application.GetResourceStream always seems to return null when I try and access the files. I have tried a number of ways to achieve this but can't seem to do it. How do you reference the CSV files from code behind?

Thanks in advance.

Best Answer

How to Get Files From Resources in Silverlight 2.0

StreamResourceInfo sr = Application.GetResourceStream(new Uri("MyImage.png", UriKind.Relative));

BitmapImage bmp = new BitmapImage();

bmp.SetSource(sr.Stream);

Related Topic