CoverFlowControl in silverlight how can I add pictures ??

I have a CoverFlowControl in xaml page, within this control I am adding pictures with the code

<Image Source="{Binding ImageUrl}" CacheMode="BitmapCache" Height="385" ImageOpened="Image_ImageOpened" />

and it reads an xml file and gets the image url with  

ImageUrl = xMovie.Element("poster").Element("location").Value;

and it brings the pictures but instead of this I want to read the pictures from a folder instead in my local drive and for that I need to add pictures to my CoverFlowControl.Items.Add() but i can not give the picture name to that it gives an error.. Basically my question is how can I add the pictures on my local drive to CoverFlowControl ??
fatihdiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CuteBugCommented:
Check this link

http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx


// Create source
BitmapImage myBitmapImage = new BitmapImage();

// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg");

// To save significant application memory, set the DecodePixelWidth or  
// DecodePixelHeight of the BitmapImage value of the image source to the desired 
// height or width of the rendered image. If you don't do this, the application will 
// cache the image as though it were rendered as its normal size rather then just 
// the size that is displayed.
// Note: In order to preserve aspect ratio, set DecodePixelWidth
// or DecodePixelHeight but not both.
myBitmapImage.DecodePixelWidth = 200;
myBitmapImage.EndInit();
//set image source
ImageSource = myBitmapImage;

Open in new window

0
fatihdiAuthor Commented:
Unfortunately it did not work for me... it is giving error on

<Image Width="200">
  <Image.Source>
    <!-- To save significant application memory, set the DecodePixelWidth or  
     DecodePixelHeight of the BitmapImage value of the image source to the desired
     height and width of the rendered image. If you don't do this, the application will
     cache the image as though it were rendered as its normal size rather then just
     the size that is displayed. -->
    <!-- Note: In order to preserve aspect ratio, only set either DecodePixelWidth
         or DecodePixelHeight but not both. -->
    <BitmapImage DecodePixelWidth="200"  
     UriSource="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg" />
  </Image.Source>

so is there another way to implement this ? I need to give a source to CoverflowControl as

CoverflowControl.ItemsSource = "source";

and source should be a collection of images... and it should display on CoverflowControl


0
CuteBugCommented:
Create a list of BitmapImage.

List<BitmapImage> myImageSource = new List<BitmapImage>():

//add your images to this list.
myImageSource.Add(...);
myImageSource.Add(...);
myImageSource.Add(...);
myImageSource.Add(...);

CoverflowControl.ItemsSource = myImageSource;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.