H! there
Please tell me how can i bind XamCrouselPanle with Database.
As i want to bind images from database to XamCrouselPanel. I tried doing so but it only access the first top image from datasource on clicking crouselnext button i dont get other images. It shows only one image floating on the path.
Below is the Xaml Code for XamCrouselPanel
<
="#FFD4CDCD"/></igWindows:CarouselViewSettings.ItemPathRenderPen> </igWindows:CarouselViewSettings></igWindows:XamCarouselPanel.ViewSettings>
<Image Width="100" Height="100" Source="{Binding Path=Photo}"/>
</igWindows:XamCarouselPanel>
Please Tell me How can i bind multiple images to XamCrouselPanel through Datasource?
With above code it only loads first topmost image from datasource it doesnt show rest other images from datasource? How can i achieve it?
Kindly Reply
Thank you
Regards
Vijay Gaur
Xployt Solution
XamCarouselPanel is a Panel. Setting the DataContext of a Panel doesn't populate it with items. You would probably want to use the XamCarouselListBox (which is a custom ItemsControl that uses a XamCarouselPanel) and bind the ItemsSource to your data source and then set the ItemTemplate to a DataTemplate that contains the Image element that you currently have as the only child of the panel.
H! Alex
Thank you very much for the reply.
Well i am not storing iimage as a byte in database. I am jus6 storing the path of image which are stored somewhere in computer and i am binding the path to source attribute of Image control as show in the Xaml code above. <Image Source="{Binding Path=Photo}"> Here i am binding the path of Image from database Photo stores the path. But i get the first topmost image loaded in XamCrouselPanel but i dont get the rest other images whose path is saved in database.
Other way i can say i am getting only the first record of the table not otthers. Though it should load all other records in XamCrouselPanel. In my case the record here stores only Image Path.
I hope you got my problem i am not finding anyway to do it.? i don understand why it is not loading all the images as it loads only one image that is the first image of my datasource.
Kindly Reply soon
Hello Vijay,
The images are stored as byte arrays in the data base. You need to extract the bytes and create a bitmap image from them, using a memory stream.
I am attaching a small sample project of this (using the NorthWind database) and XamDataGrid. As you are using XamCarouselPanel, you have to create Images and add them as child elements of the carousel, but the approach is the same.
Let me know if you have questions on this.