James Hughes
James Hughes

Reputation: 6194

Load File in XAP

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.

Upvotes: 3

Views: 1457

Answers (1)

JustinAngel
JustinAngel

Reputation: 16102

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);

Upvotes: 5

Related Questions