Incompatibility between SuperImage control from Coding 4 Fun Toolkit and Telerik controls

2 posts, 0 answers
  1. QMatteoQ
    QMatteoQ avatar
    6 posts
    Member since:
    Oct 2010

    Posted 06 Feb 2014 Link to this post

    Hi, I'm facing a weird issue when I try to use the SuperImage control from the Coding4Fun Toolkit in an application built with Telerik controls.
    Here is my scenario: I would like to use the SuperImage control because it has the capability to load images from the isolated storage, simply by adding the prefix isostore:/ to the path of the image.
    I'm trying to use it inside a DataTemplate, which is used as ItemTemplate of a RadJumpList control. 

    <DataTemplate x:Key="OfflineMoviesTemplate">
        <Grid Margin="-12,12,0,12" >
     
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="96" />
            </Grid.ColumnDefinitions>
     
            <controls:SuperImage Width="100" Height="150" HorizontalAlignment="Left" Source="{Binding Path=PosterThumbnailPath, Converter={StaticResource IsolatedStorageImagesConverter}, ConverterParameter=Small}"
                                 PlaceholderImageSource="/Assets/Images/NoPoster.png" PlaceholderImageStretch="UniformToFill" Stretch="UniformToFill" />
     
            <StackPanel Margin="-14,0,0,0" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Left">
                <StackPanel VerticalAlignment="Top">
                    <TextBlock FontSize="20"
                           FontWeight="ExtraBold"
                           Text="{Binding Title, Converter={StaticResource UppercaseConverter}}" TextWrapping="Wrap" TextAlignment="Left" />
                </StackPanel>
                <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Orientation="Horizontal" Margin="-10, 0 ,0, 0">
                    <Image Source="/Assets/Icons/View.png"  Visibility="{Binding Path=HasSeen, Converter={StaticResource BooleanToVisibilityConverter}}" Width="48" Height="48" />
                    <Image Source="/Assets/Icons/DVD.png" Visibility="{Binding Path=IsInCollection, Converter={StaticResource BooleanToVisibilityConverter}}" Width="48" Height="48" />
                </StackPanel>
            </StackPanel>
     
        </Grid>
    </DataTemplate>

    Here is, instead, the definition of the RadJumpList control:
    <telerikDataControls:RadJumpList ItemTemplate="{StaticResource OfflineMoviesTemplate}"
                                 ItemsSource="{Binding Path=Movies}"
                                 GroupPickerItemsSource="{Binding Path=GroupPickerItems}"
                                 GroupPickerItemTap="RadJumpList_OnGroupPickerItemTap"
                                 GroupDescriptorsSource="{Binding Path=GroupDescriptors}"
                                 SortDescriptorsSource="{Binding Path=SortDescriptors}"
                                 SelectedItem="{Binding Path=SelectedMovie, Mode=TwoWay}"
                                 EmptyContentDisplayMode="DataSourceEmpty"
                                 EmptyContentTemplate="{StaticResource LocalMoviesEmptyContentTemplate}"
                                 IsCheckModeEnabled="True"
                                 IsCheckModeActive="{Binding Path=IsMultiSelectActive, Mode=TwoWay}"
                                 IsStickyHeaderEnabled="False"
                                 GroupCheckMode="None"
                                 x:Name="MyMovies"
                                 telerik:InteractionEffectManager.IsInteractionEnabled="True">


    If I do this, whenever I launch the application I get a XamlParseException with the following error: [Line: 0, Position: 0].
    The exception is raised when, in code, I initialize the collection I use to define the SortDescriptor of the RadJumpList control

    SortDescriptors = new ObservableCollection<DataDescriptor>();

    From the stack , I can see that the exception is generated by Telerik classes.

       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at Telerik.Windows.Controls.StackVirtualizationStrategy.MeasureContainer(RadVirtualizingDataControlItem container)
       at Telerik.Windows.Controls.VirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Int32 insertAt)
       at Telerik.Windows.Controls.StackVirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Int32 insertAt)
       at Telerik.Windows.Controls.VirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Boolean insertLast)
       at Telerik.Windows.Controls.VirtualizationStrategy.ManageLowerViewport(Boolean recycle)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.ManageViewport()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.BalanceVisualSpace()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.CleanupAfterCollectionReset()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnCollectionReset()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.UpdateViewportOnItemsChange(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadJumpList.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.Primitives.DataControlBase.OnListSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadListSource.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadListSource.RefreshOverride()
       at Telerik.Windows.Data.RadCollectionViewSource.RefreshOverride()
       at Telerik.Windows.Data.RadListSource.Refresh()
       at Telerik.Windows.Data.RadCollectionViewSource.OnGroupDescriptorsChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
       at Telerik.Windows.Controls.RadJumpList.HandleSourceCollectionChangedForDataDescriptorCollection(ObservableCollection`1 target, NotifyCollectionChangedEventArgs sourceArgs)
       at Telerik.Windows.Controls.RadJumpList.Telerik.Windows.Data.IWeakEventListener.ReceiveEvent(Object sender, EventArgs e)
       at Telerik.Windows.Data.WeakEventHandler`1.ProcessEvent(Object sender, EventArgs e)
       at Telerik.Windows.Data.WeakEventHandler`1.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
       at System.Collections.ObjectModel.Collection`1.Add(T item)
       at MoviesTracker.ViewModels.MainPageViewModel.<OnInitialize>d__13.MoveNext()

     If I remove the SuperImage control, instead, everything works just fine. Do you have any idea what's going on?
    Thanks!
  2. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 10 Feb 2014 Link to this post

    Hi Matteo,

    Thanks for writing and for the provided details.

    This seems to be somehow related to the fact that Item containers are reused in DataBoundListBox/JumpList by the UI virtualization mechanism. Why this exception happens is something I cannot exactly tell right now. Is it possible for you to send me your project with the needed references so that I can take a look and see how I can help?

    Thanks for your time. 

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  3. DevCraft banner
Back to Top