none
Dynamically Loading Images in SilverLight 3.0

    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)
    7. prosince 2010 17:46

Odpovědi

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

    http://knowledge-base.havit.cz/silverlight-wpf/Nastaveni-Image-Source-z-kodu.aspx

    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
    29. března 2011 20:22
    Moderátor