CarouselItems need to be scrolled into view

2 posts, 1 answers
  1. Boots
    Boots avatar
    81 posts
    Member since:
    Dec 2008

    Posted 22 Dec 2009 Link to this post

    Hello,

    Just updated to version 2009.3.1208.35. Found a problem, well it worked with the last version. When i set the RadCarouselPannel ItemsPerPage to 7 and only display 6 items i need to scroll the items in order to see them. on the last version i didnt need to. I was curious if this is expected and i need to code around this?

    here is a quick example
    <Window  
        x:Class="WpfApplication1.Window1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        Title="Window1"
        <Grid> 
            <telerik:RadCarousel x:Name="RadCaoursel1"
                <telerik:RadCarousel.ItemsPanel> 
                    <ItemsPanelTemplate> 
                        <telerik:RadCarouselPanel 
                                ItemsPerPage="7" /> 
                    </ItemsPanelTemplate> 
                </telerik:RadCarousel.ItemsPanel> 
            </telerik:RadCarousel> 
        </Grid> 
    </Window> 

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Text; 
    using System.Windows; 
    using System.Windows.Controls; 
    using System.Windows.Data; 
    using System.Windows.Documents; 
    using System.Windows.Input; 
    using System.Windows.Media; 
    using System.Windows.Media.Imaging; 
    using System.Windows.Navigation; 
    using System.Windows.Shapes; 
    using System.Collections.ObjectModel; 
     
    namespace WpfApplication1 
        /// <summary> 
        /// Interaction logic for Window1.xaml 
        /// </summary> 
        public partial class Window1 : Window 
        { 
            public Window1() 
            { 
                InitializeComponent(); 
     
                ObservableCollection<CarouselExample> items = new ObservableCollection<CarouselExample>(); 
     
                for (int i = 0; i < 6; i++) 
                { 
                    items.Add(new CarouselExample() { Name = "Test" + i }); 
                } 
                this.RadCaoursel1.ItemsSource = items
            } 
        } 
     
        public class CarouselExample 
        { 
            public String Name { get; set; } 
        } 
     

    thanks much,
    ~Boots
  2. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 25 Dec 2009 Link to this post

    Hi Boots,

    Currently this is the expected behavior - the carousel will automatically load items if there are enough items to fill all available slots. We are thinking of providing more options for the auto load behavior but for the time being you can use the BringDataItemIntoView method to load items. For example:

    this.RadCarousel1.ItemsSource = data;
    this.RadCarousel1.BringDataItemIntoView(this.RadCarousel1.Items[0]);

    Greetings,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top