Data is not displayed in the RadCarousel control for items less than 8

6 posts, 1 answers
  1. Shweta Patole
    Shweta Patole avatar
    4 posts
    Member since:
    Jul 2009

    Posted 14 Jul 2009 Link to this post

    Hi,

    .xaml Code:

    <

     

    telerik:RadCarousel x:Name="rdcTasks" AutoGenerateDataPresenters="False" telerik:StyleManager.Theme="Office_Black" Margin="0,227,0,6" SelectionChanged="rdcTasks_SelectionChanged" Height="179" VerticalAlignment="Bottom" Loaded="rdcTasks_Loaded"></telerik:RadCarousel>

    .net code:

     

    foreach

     

    (TaskQueryService.task objTask in objTasks)  

     

     

    this.rdcTasks.Items.Add(objTask);

    As the the number of items in the datasource is 4, the control doesnt display any data on the screen. I have to scroll to get the stuff displayed. where as if the items are 8 or more the items are displayed. I have another control with same properties set and its working. (dataitems are 49).

    Please reply.

    Shweta

     

     

     

  2. Shweta Patole
    Shweta Patole avatar
    4 posts
    Member since:
    Jul 2009

    Posted 14 Jul 2009 Link to this post

    ItemsPerPage is the culprit. its working now. :)
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 14 Jul 2009 Link to this post

    Hello Shweta Patole,

    RadCarousel will not automatically fill its path with items if the number of items is less than the value of the ItemsPerPage property. In case you have few items you can use RadCarouselPanel.BringDataItemIntoView to bring a specific item to the center of the path, once the carousel is loaded.

    void RadCarousel_Loaded(object sender, RoutedEventArgs e)  
    {  
       var recordToBring = this.Carousel.Records[2];  
       this.Carousel.FindCarouselPanel().BrindDataItemIntoView(recordToBrind);  

    Hope this helps.

    Regards,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Maria Im
    Maria Im avatar
    10 posts
    Member since:
    Sep 2012

    Posted 05 Nov 2009 Link to this post

    This still does not work for me.  I want the first record to always be displayed at the center of the path.
    Here is my code. I am pulling the documents from a comboBox and as I select them, they get added to the carousel. But it always appears on the left side and the opacity is low on it. i want it to appear in the center, fully visible. How do i do that? the XAMl for this, looks like the standard xaml, telerik has. the only thing i changed is the dataBinding.So assume it looks the same.
      public partial class DocumentsSelectionView : UserControl, IDocumentsSelectionView  
        {  
            public DocumentsSelectionView()  
            {  
                InitializeComponent();          
            }  
     
            public IDocumentsSelectionPresentationModel Model  
            {  
                get { return this.DataContext as IDocumentsSelectionPresentationModel; }  
                set 
                {  
                    this.DataContext = value;  
                }  
            }  
     
            private void categoryComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)  
            {  
                Guid selectedCategoryKey = Guid.Empty;  
                if (e.AddedItems.Count > 0)  
                {  
                    selectedCategoryKey = (e.AddedItems[0] as IDocumentCategory).Key;  
                }  
                CategorySelectionChanged(thisnew CategorySelectionChangedEventArgs(selectedCategoryKey));  
            }  
     
            private void selectDocumentButton_Click(object sender, RoutedEventArgs e)  
            {  
                var selectedDocument = (sender as FrameworkElement).DataContext as IDocumentForSelection;  
                selectedDocument.Selected = true;  
                DocumentSelectedChanged(thisnew EventArgs<IDocumentForSelection>(selectedDocument));  
     
                radCarousel1.ItemsSource = Model.SelectedDocuments;  
                Path path = CreateLinePath();  
     
                SetCarouselPanel(path, sender);  
                SetCarouselReflection();  
            }  
     
            private Path CreateLinePath()  
            {  
                Path path = (Path)this.MyGrid.FindResource("CarouselPath");  
                path.Stretch = Stretch.UniformToFill;  
                BrushConverter brushConverter = new BrushConverter();  
                path.Stroke = (Brush)brushConverter.ConvertFromString("#FF0990fe");  
                path.StrokeThickness = 2;  
                return path;  
     
                //Path newPath = new Path();  
                //PathFigureCollectionConverter figureConverter = new PathFigureCollectionConverter();  
                //object geometryFigures = figureConverter.ConvertFromString("M30,347 L307.5,347");  
                //PathGeometry newGeometry = new PathGeometry();  
                //newPath.Stretch = Stretch.Fill;  
                //BrushConverter brushConverter = new BrushConverter();  
                //newPath.Stroke = (Brush)brushConverter.ConvertFromString("#FF0998f8");  
                //newPath.StrokeThickness = 2;  
                //newGeometry.Figures = (PathFigureCollection)geometryFigures;  
                //newPath.Data = (Geometry)newGeometry;  
                //return newPath;  
            }  
     
            private void SetCarouselPanel(Path path, Object sender)  
            {  
                 
                RadCarouselPanel panel = this.radCarousel1.FindCarouselPanel();  
                var recordToBring = this.radCarousel1.Records[0];  
                panel.BringDataItemIntoView(recordToBring);  
                panel.ItemsPerPage = 5;  
                panel.Path = path;  
            }  
            private void SetCarouselReflection()  
            {  
                this.radCarousel1.ReflectionSettings.Visibility = Visibility.Visible;  
                this.radCarousel1.ReflectionSettings.Opacity = 0.5;  
            } 
  6. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 06 Nov 2009 Link to this post

    Hi Maria Im,

    Whenever you set new ItemsSource on RadCarousel it will run a special animation that loads several items into the carousel. This animation takes precedence over the BringDataItemIntoView animation and the later animation is ignored. We have recently introduced new property on RadCarouselPanel called AutoLoadItems which disables the initial animation when the property is set to false.

    With our latest release you will be able to do the following:

    <telerik:RadCarousel x:Name="carousel">
        <telerik:RadCarousel.ItemsPanel>
            <ItemsPanelTemplate>
                <telerik:RadCarouselPanel AutoLoadItems="False" />
            </ItemsPanelTemplate>
        </telerik:RadCarousel.ItemsPanel>
    </telerik:RadCarousel>

    This will disable the initial animation and BringDataItemIntoView will work.
    Those latest improvements will be available this Friday with our latest internal build for Q3.


    Sincerely yours,
    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.
  7. Maria Im
    Maria Im avatar
    10 posts
    Member since:
    Sep 2012

    Posted 06 Nov 2009 Link to this post

    Thanks. Meanwhile, I am calling the radcarousel.loaded += {event and stuff etc...} programmatically to make it work and it works now. But I am looking foward for the new build.
    Maria
Back to Top
UI for WPF is Visual Studio 2017 Ready