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

Binding carousel items to column of gridview

1 Answer 110 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Nathan
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.

Thanks,
Nate

1 Answer, 1 is accepted

Sort by
0
Maya
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;
    window.Show();         
}

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">
    <telerik:RadCarousel.ItemTemplate>
        <DataTemplate>
            <TextBox Text="{Binding Name}"/>
        </DataTemplate>
    </telerik:RadCarousel.ItemTemplate>
</telerik:RadCarousel>

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,
Maya
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
Tags
Carousel
Asked by
Nathan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or