2 posts, 0 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Mar 2015

    Posted 19 Oct 2015 Link to this post


    When I added Telerik to my application, I used .Net framework 4.5 and platform target x86. I used a RadCarousel and it worked perfect. Later I had to switch to .Net 4.0 framework and change the Telerik version to v.2014.3.1021.40. But now I have a problem. I reduced the code to a minimum for a test purposes:

    <Window x:Class="myBRH.AddPhotosWnd"
            Title="AddPhotosWnd" Height="300" Width="1024">
                <ColumnDefinition Width="10*"/>
                <ColumnDefinition Width="135*"/>
                <ColumnDefinition Width="855*"/>
                <ColumnDefinition Width="16*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="10*"/>
                <RowDefinition Height="3*"/>
                <RowDefinition Height="36*"/>
                <RowDefinition Height="3*"/>
                Grid.Column="1" Grid.Row="1" Click="Button_Click"/>
            <telerik:RadCarousel x:Name="rc" Grid.Column="1" Grid.ColumnSpan="2"
                                 Grid.Row="3" HorizontalScrollBarVisibility="Hidden"/>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    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.Shapes;
    namespace myBRH
        /// <summary>
        /// Interaction logic for AddPhotosWnd.xaml
        /// </summary>
        public partial class AddPhotosWnd : Window
            public AddPhotosWnd()
            private void Button_Click(object sender, RoutedEventArgs e)
                string str = "sdfsd";

     The problem:

    When second item is added to the RadCarousel.Items,  System.InvalidOperationException is thrown  with the message: "Collection was modified; enumeration operation may not execute."

    Exception is not thrown if I comment out the rc.BringDataItemIntoView(rc.Items[0]); method call.






    <Window x:Class="mytest.Wnd"
            Height="300" Width="1024">
                <ColumnDefinition Width="10*"/>
                <ColumnDefinition Width="135*"/>
                <ColumnDefinition Width="855*"/>
                <ColumnDefinition Width="16*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="10*"/>
                <RowDefinition Height="3*"/>
                <RowDefinition Height="36*"/>
                <RowDefinition Height="3*"/>
                Grid.Column="1" Grid.Row="1" Click="Button_Click"/>
            <telerik:RadCarousel x:Name="rc" Grid.Column="1" Grid.ColumnSpan="2"
                                 Grid.Row="3" HorizontalScrollBarVisibility="Hidden"/>
  2. Maya
    Maya avatar
    4062 posts

    Posted 21 Oct 2015 Link to this post

    Hello Mark,

    I tried to reproduce the exception but without any success. Could you take a look at the project attached and let me know whether there is anything missing ? What should be updated in order to get the same behavior as the one on your side ?

    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top