This question is locked. New answers and comments are not allowed.
                        
                        Hello Telerik support team,
I'm trying to Data Bind a dynamic collection of Items in the RadCycleHubTile.ItemsSource property like this:
Also to be noted is that this is a collection of (static) RadCycleHubTiles inside a ListBox.
The AllFeedItems property of my ViewModel gets loaded dynamically, and more importantly asynchronously:
 
 
 
 
 
So the issue is that a *runtime* InvalidOperationException is thrown when this code is run, not immediately but after the AllFeedItems collection gets asynchronously modified (that is, a couple of seconds after the loaded event). This makes me think that the issue roots from the fact that the ObservableCollection is not thread safe. I have tried a couple of "ThreadSafeObservableCollection" implementations found on the web, but the same error keeps happening. This is the Exception details:
System.InvalidOperationException was unhandled
Message=InvalidOperationException
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Telerik.Windows.Controls.RadCycleHubTile.GetNextItem()
at Telerik.Windows.Controls.RadCycleHubTile.GetItem(Boolean random)
at Telerik.Windows.Controls.RadCycleHubTile.Update()
at Telerik.Windows.Controls.HubTileBase.OnUpdateTimerTick(Object sender, EventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Any ideas?
Thanks!
                                I'm trying to Data Bind a dynamic collection of Items in the RadCycleHubTile.ItemsSource property like this:
<ListBox x:Name="SourceList"    Margin="0,0,-12,0"    ItemsSource="{Binding Sources}"    SelectionChanged="SourceListSelectionChanged">    <ListBox.ItemsPanel>        <ItemsPanelTemplate>            <toolkit:WrapPanel Orientation="Horizontal" />        </ItemsPanelTemplate>    </ListBox.ItemsPanel>    <ListBox.ItemTemplate>        <DataTemplate>            <telerikPrimitives:RadCycleHubTile                telerikPrimitives:RadHubTileService.GroupTag="ContentsCycleTile"                Grid.Row="0" Grid.Column="0"                Width="276" Height="132"                Padding="12, 0, 0, 8"                Title="{Binding Title}"                FontSize="{StaticResource PhoneFontSizeMedium}"                Margin="12, 8, 0, 0"                CycleRandomly="False"                UpdateInterval="{Binding Path=SelectedItem, ElementName=SourceList, Converter={StaticResource TimeSpanGenerator}}"                ItemsSource="{Binding AllFeedItems}">                <telerikPrimitives:RadCycleHubTile.ItemTemplate>                    <DataTemplate>                        <StackPanel Margin="12, 6, 12, 12">                            <TextBlock FontSize="15">                                On <Run Text="{Binding Date}"/>:                            </TextBlock>                            <Grid Margin="0, 12, 0, 0">                                <Grid.ColumnDefinitions>                                    <ColumnDefinition Width="50"/>                                    <ColumnDefinition Width="*"/>                                </Grid.ColumnDefinitions>                                <Image VerticalAlignment="Top"                                    Stretch="Uniform"                                    Source="{Binding ImageUrl}"/>                                <TextBlock Text="{Binding Title}"                                    FontSize="15"                                    TextWrapping="Wrap"                                    TextTrimming="WordEllipsis"                                    Margin="12, 0, 0, 0"                                    Grid.Column="1"                                    VerticalAlignment="Top"                                    HorizontalAlignment="Left"                                    Height="70"/>                            </Grid>                        </StackPanel>                    </DataTemplate>                </telerikPrimitives:RadCycleHubTile.ItemTemplate>            </telerikPrimitives:RadCycleHubTile>        </DataTemplate>    </ListBox.ItemTemplate></ListBox>Also to be noted is that this is a collection of (static) RadCycleHubTiles inside a ListBox.
The AllFeedItems property of my ViewModel gets loaded dynamically, and more importantly asynchronously:
private void PanoramaIntroLoaded(object sender, RoutedEventArgs e){    RadHubTileService.UnfreezeGroup("ContentsCycleTile");    if (!App.ViewModel.PanoramaIntroVM.IsDataLoaded)    {        App.ViewModel.PanoramaIntroVM.Reload();    }}// And then in the Reload() method:public void Reload(){    foreach (MainPageVM vm in Sources)    {        vm.DownloadItems();    }    IsDataLoaded = true;}// And the in the DownloadItems() method:public void DownloadItems(){    _WebClient = new WebClient();    _WebClient.DownloadStringCompleted += ClientDownloadStringCompleted;    _WebClient.DownloadStringAsync(new Uri(FeedUri));}// And then in the ClientDownloadStringCompleted we Clear() and then Add() items to the AllFeedItems ObservableCollectionSo the issue is that a *runtime* InvalidOperationException is thrown when this code is run, not immediately but after the AllFeedItems collection gets asynchronously modified (that is, a couple of seconds after the loaded event). This makes me think that the issue roots from the fact that the ObservableCollection is not thread safe. I have tried a couple of "ThreadSafeObservableCollection" implementations found on the web, but the same error keeps happening. This is the Exception details:
System.InvalidOperationException was unhandled
Message=InvalidOperationException
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Telerik.Windows.Controls.RadCycleHubTile.GetNextItem()
at Telerik.Windows.Controls.RadCycleHubTile.GetItem(Boolean random)
at Telerik.Windows.Controls.RadCycleHubTile.Update()
at Telerik.Windows.Controls.HubTileBase.OnUpdateTimerTick(Object sender, EventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Any ideas?
Thanks!
