Binding carousel items to column of gridview

2 posts, 0 answers
  1. Nathan
    Nathan avatar
    1 posts
    Member since:
    Jul 2010

    Posted 24 Aug 2010 Link to this post

    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.

  2. Maya
    Maya avatar
    4062 posts

    Posted 26 Aug 2010 Link to this post

    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
  3. DevCraft R3 2016 release webinar banner
Back to Top