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?
The path you have provided is not relative. It is absolute. Relative is if it is in the project directory.
You can set the UriKind to RelativeOrAbsolute.
Thanks Alex,
but it is not working, I tried like this
Uri ImageUri = null;
ImageUri = new Uri(@"D:\Ravinder\Ravi\personal\RP\personal\me1.JPG", UriKind.Relative);
img.Source = image;
img.Width = 150;
img.Height=150;
CarouselPanel.ChildElements.Add(img);
but it is not displaying any images. Am i missing any settings?
Please let me know?
Hello,
The XamCarouselPanel exposes a ChildElements collection which stores the elements in the CarouselPanel. You can add the images directly in this collection.
xamCarouselPanel1.ChildElements.Add(new Button() { Content = "Button", Width = 100, Height = 100 });
Hope this helps.