Right now we are adding images to the xamcarouselpanel in the xaml code.
But I want to add them dynamically in codebehind file(C#).
How can I do this?
Yes Alex,
Thanks
Did you find what was the reason for this ? Incorrect uri?
Its working fine...
Uri ImageUri = null; ImageUri = new Uri(@"D:\Imagesr\Image\personal\emp1.JPG"); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = ImageUri; Image im = new Image(); im.Width = 50; im.Height = 50; im.Source = image; image.CacheOption = BitmapCacheOption.Default; image.EndInit(); CarouselPanel.ChildElements.Add(im);
Hi Alex,
I am also doing the same as below, but it is not showing images in carousel panel.
What is the problem? Am i missing any thing? Please let me know..
Uri ImageUri = null; ImageUri = new Uri(@"D:\Images\emp1.JPG"); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = ImageUri; Image im = new Image(); im.Width = 50; im.Height = 50; im.Source = image; image.CacheOption = BitmapCacheOption.Default; image.EndInit(); CarouselPanel.ChildElements.Add(image);
i am adding the images dynamically using the following code. but it is not displaying any images in carousel panel.
Uri ImageUri = null; ImageUri = new Uri(@"D:\Imagesr\Image\personal\emp1.JPG"); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = ImageUri; Image im = new Image(); im.Width = 50; im.Height = 50; im.Source = image; image.CacheOption = BitmapCacheOption.Default; image.EndInit(); CarouselPanel.ChildElements.Add(image);