This is a migrated thread and some comments may be shown as answers.

Binding carousel items to column of gridview

1 Answer 107 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Nathan asked on 24 Aug 2010, 04:09 PM
What is the best way to bind the items of a carousel to a column (images that are of type byte[]) of a gridView which is itself bound to a database table.  I ultimately want to populate the carousel with only the images from the selected rows in the gridView.  Any pointers would be appreciated.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 26 Aug 2010, 03:09 PM
Hi Nathan,

A good approach is to set the ItemsSource of the RadCarousel to the SelectedItems Property of the grid.
private void Button1_Click(object sender, RoutedEventArgs e)
    RadCarouselControl carousel = new RadCarouselControl();
    carousel.Carousel.ItemsSource = this.playersGrid.SelectedItems;        
    window.Content = carousel;

Following up the code above, the RadCarousel will appear on clicking on Button1.
If you want to show only one of the properties in the Items of the carousel (in your case just the picture), you can set the ItemTemplate of RadCarosel and bind the item to the desired property. For example:
<telerik:RadCarousel x:Name="Carousel" Background="Black" Height="300">
            <TextBox Text="{Binding Name}"/>

In this case the items in the carousel will be the names of the players.
I am sending you a sample project with the illustrated solution so that you can use it as a reference.

Kind regards,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question