Defining item source on page load not working.

2 posts, 0 answers
  1. Saad
    Saad avatar
    82 posts
    Member since:
    Oct 2008

    Posted 17 Dec 2008 Link to this post

    I have few images at path "C:\Images\", and m loading my images at Page_Load event of silverlight page. But its not working....please help!
    Here`s my code:

    ObservableCollection<string> imagesCollection = new ObservableCollection<string>();
    string[] arr = Directory.GetFiles(@"C:\Images\");
    for (int a = 0; a < arr.Length; a++ )
    {
        imagesCollection.Add(arr[a]);
    }                
    CoverFlow.DataContext = imagesCollection;

    Everything is fine with the code but still not getting any positive signs....please help me!
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 19 Dec 2008 Link to this post

    Hi saadi,

    The problem is that the Silverlight application cannot get the list of files on C:\Images\, because its working in a sandbox and doesn't have permission to read the local file system. You should create a WebSite and make it give you the images. I'm attaching an example how to achieve this.
    Hope that helps.

    All the best,
    Miroslav Nedyalkov
  3. DevCraft banner
Back to Top