Dynamically Loading Images in SilverLight 3.0 RRS feed

  • Dotaz

  • Hi, could someone please write a "simple" instructions on how to dynamically load (do not know the names or number of files) from your images and display them in the application? Thanks :o)
    úterý 7. prosince 2010 17:46


  • Hi, you can set your images sources from the code by using following code:

    myImage.Source = new BitmapImage(new Uri("images/myImage.jpg", UriKind.Relative));


    If you want to add new images to the screen dynamically, you have to add new Image() class instances to the Children collection of containing element, ie. Canvas.

    See http://blogs.silverlight.net/blogs/msnow/archive/2008/06/06/dynamically-loading-and-display-images-in-beta-2.aspx

    Robert Haken, Microsoft MVP ASP/ASP.NET, HAVIT, s.r.o., www.havit.cz, http://knowledge-base.havit.cz
    úterý 29. března 2011 20:22